Mercurial > hg
view tests/test-convert-splicemap.t @ 44363:f7459da77f23
nodemap: introduce an option to use mmap to read the nodemap mapping
The performance and memory benefit is much greater if we don't have to copy all
the data in memory for each information. So we introduce an option (on by
default) to read the data using mmap.
This changeset is the last one definition the API for index support nodemap
data. (they have to be able to use the mmaping).
Below are some benchmark comparing the best we currently have in 5.3 with the
final step of this series (using the persistent nodemap implementation in
Rust). The benchmark run `hg perfindex` with various revset and the following
variants:
Before:
* do not use the persistent nodemap
* use the CPython implementation of the index for nodemap
* use mmapping of the changelog index
After:
* use the MixedIndex Rust code, with the NodeTree object for nodemap access
(still in review)
* use the persistent nodemap data from disk
* access the persistent nodemap data through mmap
* use mmapping of the changelog index
The persistent nodemap greatly speed up most operation on very large
repositories. Some of the previously very fast lookup end up a bit slower because
the persistent nodemap has to be setup. However the absolute slowdown is very
small and won't matters in the big picture.
Here are some numbers (in seconds) for the reference copy of mozilla-try:
Revset Before After abs-change speedup
-10000: 0.004622 0.005532 0.000910 × 0.83
-10: 0.000050 0.000132 0.000082 × 0.37
tip 0.000052 0.000085 0.000033 × 0.61
0 + (-10000:) 0.028222 0.005337 -0.022885 × 5.29
0 0.023521 0.000084 -0.023437 × 280.01
(-10000:) + 0 0.235539 0.005308 -0.230231 × 44.37
(-10:) + :9 0.232883 0.000180 -0.232703 ×1293.79
(-10000:) + (:99) 0.238735 0.005358 -0.233377 × 44.55
:99 + (-10000:) 0.317942 0.005593 -0.312349 × 56.84
:9 + (-10:) 0.313372 0.000179 -0.313193 ×1750.68
:9 0.316450 0.000143 -0.316307 ×2212.93
On smaller repositories, the cost of nodemap related operation is not as big, so
the win is much more modest. Yet it helps shaving a handful of millisecond here
and there.
Here are some numbers (in seconds) for the reference copy of mercurial:
Revset Before After abs-change speedup
-10: 0.000065 0.000097 0.000032 × 0.67
tip 0.000063 0.000078 0.000015 × 0.80
0 0.000561 0.000079 -0.000482 × 7.10
-10000: 0.004609 0.003648 -0.000961 × 1.26
0 + (-10000:) 0.005023 0.003715 -0.001307 × 1.35
(-10:) + :9 0.002187 0.000108 -0.002079 ×20.25
(-10000:) + 0 0.006252 0.003716 -0.002536 × 1.68
(-10000:) + (:99) 0.006367 0.003707 -0.002660 × 1.71
:9 + (-10:) 0.003846 0.000110 -0.003736 ×34.96
:9 0.003854 0.000099 -0.003755 ×38.92
:99 + (-10000:) 0.007644 0.003778 -0.003866 × 2.02
Differential Revision: https://phab.mercurial-scm.org/D7894
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 11 Feb 2020 11:18:52 +0100 |
parents | 58a309e9cf80 |
children | 2eeca9a8f4a7 |
line wrap: on
line source
$ echo "[extensions]" >> $HGRCPATH $ echo "convert=" >> $HGRCPATH $ glog() > { > hg log -G --template '{rev}:{node|short} "{desc|firstline}"\ > files: {files}\n' "$@" > } $ hg init repo1 $ cd repo1 $ echo a > a $ hg ci -Am adda adding a $ echo b > b $ echo a >> a $ hg ci -Am addb adding b $ PARENTID1=`hg id --debug -i` $ echo c > c $ hg ci -Am addc adding c $ PARENTID2=`hg id --debug -i` $ cd .. $ glog -R repo1 @ 2:e55c719b85b6 "addc" files: c | o 1:6d4c2037ddc2 "addb" files: a b | o 0:07f494440405 "adda" files: a $ hg init repo2 $ cd repo2 $ echo b > a $ echo d > d $ hg ci -Am addaandd adding a adding d $ INVALIDID1=afd12345af $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86 $ CHILDID1=`hg id --debug -i` $ echo d >> d $ hg ci -Am changed $ CHILDID2=`hg id --debug -i` $ echo e > e $ hg ci -Am adde adding e $ cd .. $ glog -R repo2 @ 2:a39b65753b0a "adde" files: e | o 1:e4ea00df9189 "changed" files: d | o 0:527cdedf31fb "addaandd" files: a d test invalid splicemap1 $ cat > splicemap <<EOF > $CHILDID2 > EOF $ hg convert --splicemap splicemap repo2 repo1 abort: syntax error in splicemap(1): child parent1[,parent2] expected [255] test invalid splicemap2 $ cat > splicemap <<EOF > $CHILDID2 $PARENTID1, $PARENTID2, $PARENTID2 > EOF $ hg convert --splicemap splicemap repo2 repo1 abort: syntax error in splicemap(1): child parent1[,parent2] expected [255] test invalid splicemap3 $ cat > splicemap <<EOF > $INVALIDID1 $INVALIDID2 > EOF $ hg convert --splicemap splicemap repo2 repo1 abort: splicemap entry afd12345af is not a valid revision identifier [255] splice repo2 on repo1 $ cat > splicemap <<EOF > $CHILDID1 $PARENTID1 > $CHILDID2 $PARENTID2,$CHILDID1 > > EOF $ cat splicemap 527cdedf31fbd5ea708aa14eeecf53d4676f38db 6d4c2037ddc2cb2627ac3a244ecce35283268f8e e4ea00df91897da3079a10fab658c1eddba6617b e55c719b85b60e5102fac26110ba626e7cb6b7dc,527cdedf31fbd5ea708aa14eeecf53d4676f38db $ hg clone repo1 target1 updating to branch default 3 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg convert --splicemap splicemap repo2 target1 scanning source... sorting... converting... 2 addaandd spliced in 6d4c2037ddc2cb2627ac3a244ecce35283268f8e as parents of 527cdedf31fbd5ea708aa14eeecf53d4676f38db 1 changed spliced in e55c719b85b60e5102fac26110ba626e7cb6b7dc and 527cdedf31fbd5ea708aa14eeecf53d4676f38db as parents of e4ea00df91897da3079a10fab658c1eddba6617b 0 adde $ glog -R target1 o 5:16bc847b02aa "adde" files: e | o 4:e30e4fee3418 "changed" files: d |\ | o 3:e673348c3a3c "addaandd" files: a d | | @ | 2:e55c719b85b6 "addc" files: c |/ o 1:6d4c2037ddc2 "addb" files: a b | o 0:07f494440405 "adda" files: a Test splicemap and conversion order $ hg init ordered $ cd ordered $ echo a > a $ hg ci -Am adda adding a $ hg branch branch marked working directory as branch branch (branches are permanent and global, did you want a bookmark?) $ echo a >> a $ hg ci -Am changea $ echo a >> a $ hg ci -Am changeaagain $ hg up 0 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo b > b $ hg ci -Am addb adding b We want 2 to depend on 1 and 3. Since 3 is always converted after 2, the bug should be exhibited with all conversion orders. $ cat > ../splicemap <<EOF > `(hg id -r 2 -i --debug)` `(hg id -r 1 -i --debug)`, `(hg id -r 3 -i --debug)` > EOF $ cd .. $ cat splicemap 7c364e7fa7d70ae525610c016317ed717b519d97 717d54d67e6c31fd75ffef2ff3042bdd98418437, 102a90ea7b4a3361e4082ed620918c261189a36a Test regular conversion $ hg convert --splicemap splicemap ordered ordered-hg1 initializing destination ordered-hg1 repository scanning source... sorting... converting... 3 adda 2 changea 1 addb 0 changeaagain spliced in 717d54d67e6c31fd75ffef2ff3042bdd98418437 and 102a90ea7b4a3361e4082ed620918c261189a36a as parents of 7c364e7fa7d70ae525610c016317ed717b519d97 $ glog -R ordered-hg1 o 3:4cb04b9afbf2 "changeaagain" files: a |\ | o 2:102a90ea7b4a "addb" files: b | | o | 1:717d54d67e6c "changea" files: a |/ o 0:07f494440405 "adda" files: a Test conversion with parent revisions already in dest, using source and destination identifiers. Test unknown splicemap target. $ hg convert -r1 ordered ordered-hg2 initializing destination ordered-hg2 repository scanning source... sorting... converting... 1 adda 0 changea $ hg convert -r3 ordered ordered-hg2 scanning source... sorting... converting... 0 addb $ cat > splicemap <<EOF > `(hg -R ordered id -r 2 -i --debug)` \ > `(hg -R ordered-hg2 id -r 1 -i --debug)`,\ > `(hg -R ordered-hg2 id -r 2 -i --debug)` > deadbeef102a90ea7b4a3361e4082ed620918c26 deadbeef102a90ea7b4a3361e4082ed620918c27 > EOF $ hg convert --splicemap splicemap ordered ordered-hg2 scanning source... splice map revision deadbeef102a90ea7b4a3361e4082ed620918c26 is not being converted, ignoring sorting... converting... 0 changeaagain spliced in 717d54d67e6c31fd75ffef2ff3042bdd98418437 and 102a90ea7b4a3361e4082ed620918c261189a36a as parents of 7c364e7fa7d70ae525610c016317ed717b519d97 $ glog -R ordered-hg2 o 3:4cb04b9afbf2 "changeaagain" files: a |\ | o 2:102a90ea7b4a "addb" files: b | | o | 1:717d54d67e6c "changea" files: a |/ o 0:07f494440405 "adda" files: a Test empty conversion $ hg convert --splicemap splicemap ordered ordered-hg2 scanning source... splice map revision deadbeef102a90ea7b4a3361e4082ed620918c26 is not being converted, ignoring sorting... converting... Test clonebranches $ hg --config convert.hg.clonebranches=true convert \ > --splicemap splicemap ordered ordered-hg3 initializing destination ordered-hg3 repository scanning source... abort: revision 717d54d67e6c31fd75ffef2ff3042bdd98418437 not found in destination repository (lookups with clonebranches=true are not implemented) [255] Test invalid dependency $ cat > splicemap <<EOF > `(hg -R ordered id -r 2 -i --debug)` \ > deadbeef102a90ea7b4a3361e4082ed620918c26,\ > `(hg -R ordered-hg2 id -r 2 -i --debug)` > EOF $ hg convert --splicemap splicemap ordered ordered-hg4 initializing destination ordered-hg4 repository scanning source... abort: unknown splice map parent: deadbeef102a90ea7b4a3361e4082ed620918c26 [255]