tests/test-rebase-brute-force.t
author Gregory Szorc <gregory.szorc@gmail.com>
Mon, 13 Nov 2017 22:20:12 -0800
changeset 35120 699b2a759319
parent 34867 7f183c643eb6
permissions -rw-r--r--
bundle2: avoid unbound read when seeking Currently, seekableunbundlepart.seek() will perform a read() during seek operations. This will allocate a buffer to hold the raw data over the seek distance. This can lead to very large allocations and cause performance to suffer. We change the code to perform read(32768) in a loop to avoid potentially large allocations. `hg perfbundleread` on an uncompressed Firefox bundle reveals a performance impact: ! bundle2 iterparts() ! wall 2.992605 comb 2.990000 user 2.260000 sys 0.730000 (best of 4) ! bundle2 iterparts() seekable ! wall 3.863810 comb 3.860000 user 3.000000 sys 0.860000 (best of 3) ! bundle2 part seek() ! wall 6.213387 comb 6.200000 user 3.350000 sys 2.850000 (best of 3) ! wall 3.820347 comb 3.810000 user 2.980000 sys 0.830000 (best of 3) Since seekable bundle parts are (only) used by bundlerepo, this /may/ speed up initial loading of bundle-based repos. But any improvement will likely only be noticed on very large bundles. Differential Revision: https://phab.mercurial-scm.org/D1394

  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > drawdag=$TESTDIR/drawdag.py
  > bruterebase=$TESTDIR/bruterebase.py
  > [experimental]
  > evolution.createmarkers=True
  > evolution.allowunstable=True
  > EOF
  $ init() {
  >   N=`expr ${N:-0} + 1`
  >   cd $TESTTMP && hg init repo$N && cd repo$N
  >   hg debugdrawdag
  > }

Source looks like "N"

  $ init <<'EOS'
  > C D
  > |\|
  > A B Z
  > EOS

  $ hg debugbruterebase 'all()-Z' Z
     A: A':Z
     B: B':Z
    AB: A':Z B':Z
     C: ABORT: cannot rebase 3:a35c07e8a2a4 without moving at least one of its parents
    AC: A':Z C':A'B
    BC: B':Z C':B'A
   ABC: A':Z B':Z C':A'B'
     D: D':Z
    AD: A':Z D':Z
    BD: B':Z D':B'
   ABD: A':Z B':Z D':B'
    CD: ABORT: cannot rebase 3:a35c07e8a2a4 without moving at least one of its parents
   ACD: A':Z C':A'B D':Z
   BCD: B':Z C':B'A D':B'
  ABCD: A':Z B':Z C':A'B' D':B'

Moving backwards

  $ init <<'EOS'
  > C
  > |\
  > A B
  > |
  > Z
  > EOS
  $ hg debugbruterebase 'all()-Z' Z
    B: B':Z
    A: 
   BA: B':Z
    C: ABORT: cannot rebase 3:b8d7149b562b without moving at least one of its parents
   BC: B':Z C':B'A
   AC: 
  BAC: B':Z C':B'A