Mercurial > hg
annotate hgeditor @ 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 | 1aee2ab0f902 |
children |
rev | line source |
---|---|
544
3d4d5f2aba9a
Remove bashisms and use /bin/sh instead of /bin/bash.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
484
diff
changeset
|
1 #!/bin/sh |
186 | 2 # |
1599
f93fde8f5027
remove the gpg stuff from hgeditor (superseded by the signing extension)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1009
diff
changeset
|
3 # This is an example of using HGEDITOR to create of diff to review the |
26781
1aee2ab0f902
spelling: trivial spell checking
Mads Kiilerich <madski@unity3d.com>
parents:
11266
diff
changeset
|
4 # changes while committing. |
684
4ccf3de52989
Turn off signing with hgeditor by default
Matt Mackall <mpm@selenic.com>
parents:
683
diff
changeset
|
5 |
666
0100a43788ca
hgeditor: Remove EMAIL default for HGUSER, comment editor selection
Radoslaw "AstralStorm" Szkodzinski <astralstorm@gorzow.mm.pl>
parents:
665
diff
changeset
|
6 # If you want to pass your favourite editor some other parameters |
0100a43788ca
hgeditor: Remove EMAIL default for HGUSER, comment editor selection
Radoslaw "AstralStorm" Szkodzinski <astralstorm@gorzow.mm.pl>
parents:
665
diff
changeset
|
7 # only for Mercurial, modify this: |
796
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
8 case "${EDITOR}" in |
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
9 "") |
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
10 EDITOR="vi" |
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
11 ;; |
348
442eb02cf870
Improved hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
280
diff
changeset
|
12 emacs) |
442eb02cf870
Improved hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
280
diff
changeset
|
13 EDITOR="$EDITOR -nw" |
442eb02cf870
Improved hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
280
diff
changeset
|
14 ;; |
442eb02cf870
Improved hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
280
diff
changeset
|
15 gvim|vim) |
442eb02cf870
Improved hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
280
diff
changeset
|
16 EDITOR="$EDITOR -f -o" |
442eb02cf870
Improved hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
280
diff
changeset
|
17 ;; |
442eb02cf870
Improved hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
280
diff
changeset
|
18 esac |
442eb02cf870
Improved hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
280
diff
changeset
|
19 |
796
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
20 |
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
21 HGTMP="" |
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
22 cleanup_exit() { |
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
23 rm -rf "$HGTMP" |
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
24 } |
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
25 |
754
3e73bf876f17
Fixes and cleanups to hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
684
diff
changeset
|
26 # Remove temporary files even if we get interrupted |
831
232d0616a80a
Cleaned up trap handling:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
814
diff
changeset
|
27 trap "cleanup_exit" 0 # normal exit |
11190
43337076ba92
Fixed a bashism with trap numbers in hgeditor.
Javi Merino <cibervicho@gmail.com>
parents:
4687
diff
changeset
|
28 trap "exit 255" HUP INT QUIT ABRT TERM |
796
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
29 |
11266
2b440bb8a66b
Fixed a bashism with the use of $RANDOM in hgeditor.
Javi Merino <cibervicho@gmail.com>
parents:
11190
diff
changeset
|
30 HGTMP=$(mktemp -d ${TMPDIR-/tmp}/hgeditor.XXXXXX) |
2b440bb8a66b
Fixed a bashism with the use of $RANDOM in hgeditor.
Javi Merino <cibervicho@gmail.com>
parents:
11190
diff
changeset
|
31 [ x$HGTMP != x -a -d $HGTMP ] || { |
2b440bb8a66b
Fixed a bashism with the use of $RANDOM in hgeditor.
Javi Merino <cibervicho@gmail.com>
parents:
11190
diff
changeset
|
32 echo "Could not create temporary directory! Exiting." 1>&2 |
2b440bb8a66b
Fixed a bashism with the use of $RANDOM in hgeditor.
Javi Merino <cibervicho@gmail.com>
parents:
11190
diff
changeset
|
33 exit 1 |
796
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
34 } |
33a272b79e54
Replaced mktemp and usage of ${par:=word}.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
769
diff
changeset
|
35 |
754
3e73bf876f17
Fixes and cleanups to hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
684
diff
changeset
|
36 ( |
3e73bf876f17
Fixes and cleanups to hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
684
diff
changeset
|
37 grep '^HG: changed' "$1" | cut -b 13- | while read changed; do |
4687
b5bbfa18daf7
hgeditor: Use $HG to run 'hg diff' (see 849f011dbf79)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4659
diff
changeset
|
38 "$HG" diff "$changed" >> "$HGTMP/diff" |
754
3e73bf876f17
Fixes and cleanups to hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
684
diff
changeset
|
39 done |
3e73bf876f17
Fixes and cleanups to hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
684
diff
changeset
|
40 ) |
348
442eb02cf870
Improved hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
280
diff
changeset
|
41 |
1599
f93fde8f5027
remove the gpg stuff from hgeditor (superseded by the signing extension)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1009
diff
changeset
|
42 cat "$1" > "$HGTMP/msg" |
684
4ccf3de52989
Turn off signing with hgeditor by default
Matt Mackall <mpm@selenic.com>
parents:
683
diff
changeset
|
43 |
3025
d9b8d28c0b94
Find the system's MD5 binary.
Will Maier <willmaier@ml1.net>
parents:
1706
diff
changeset
|
44 MD5=$(which md5sum 2>/dev/null) || \ |
4659
7a7d4937272b
Kill trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3025
diff
changeset
|
45 MD5=$(which md5 2>/dev/null) |
3025
d9b8d28c0b94
Find the system's MD5 binary.
Will Maier <willmaier@ml1.net>
parents:
1706
diff
changeset
|
46 [ -x "${MD5}" ] && CHECKSUM=`${MD5} "$HGTMP/msg"` |
1009
1bc619b12025
Don't show the diff in hgeditor if there are no changes in file contents.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
839
diff
changeset
|
47 if [ -s "$HGTMP/diff" ]; then |
1bc619b12025
Don't show the diff in hgeditor if there are no changes in file contents.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
839
diff
changeset
|
48 $EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $? |
1bc619b12025
Don't show the diff in hgeditor if there are no changes in file contents.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
839
diff
changeset
|
49 else |
1bc619b12025
Don't show the diff in hgeditor if there are no changes in file contents.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
839
diff
changeset
|
50 $EDITOR "$HGTMP/msg" || exit $? |
1bc619b12025
Don't show the diff in hgeditor if there are no changes in file contents.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
839
diff
changeset
|
51 fi |
3025
d9b8d28c0b94
Find the system's MD5 binary.
Will Maier <willmaier@ml1.net>
parents:
1706
diff
changeset
|
52 [ -x "${MD5}" ] && (echo "$CHECKSUM" | ${MD5} -c >/dev/null 2>&1 && exit 13) |
754
3e73bf876f17
Fixes and cleanups to hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
684
diff
changeset
|
53 |
1599
f93fde8f5027
remove the gpg stuff from hgeditor (superseded by the signing extension)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1009
diff
changeset
|
54 mv "$HGTMP/msg" "$1" |
348
442eb02cf870
Improved hgeditor:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
280
diff
changeset
|
55 |
831
232d0616a80a
Cleaned up trap handling:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
814
diff
changeset
|
56 exit $? |