Mercurial > hg
view tests/test-githelp.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 | 5470e63686ca |
children | 94f227baa76f |
line wrap: on
line source
$ cat >> $HGRCPATH << EOF > [extensions] > githelp = > EOF $ hg init repo $ cd repo $ echo foo > test_file $ mkdir dir $ echo foo > dir/file $ echo foo > removed_file $ echo foo > deleted_file $ hg add -q . $ hg commit -m 'bar' $ hg bookmark both $ touch both $ touch untracked_file $ hg remove removed_file $ rm deleted_file githelp on a single command should succeed $ hg githelp -- commit hg commit $ hg githelp -- git commit hg commit githelp should fail nicely if we don't give it arguments $ hg githelp abort: missing git command - usage: hg githelp -- <git command> [255] $ hg githelp -- git abort: missing git command - usage: hg githelp -- <git command> [255] githelp on a command with options should succeed $ hg githelp -- commit -pm "abc" hg commit --interactive -m 'abc' githelp on a command with standalone unrecognized option should succeed with warning $ hg githelp -- commit -p -v ignoring unknown option -v hg commit --interactive githelp on a command with unrecognized option packed with other options should fail with error $ hg githelp -- commit -pv abort: unknown option 'v' packed with other options (please try passing the option as its own flag: -v) [255] githelp for git rebase --skip $ hg githelp -- git rebase --skip hg revert --all -r . hg rebase --continue githelp for git commit --amend (hg commit --amend pulls up an editor) $ hg githelp -- commit --amend hg commit --amend githelp for git commit --amend --no-edit (hg amend does not pull up an editor) $ hg githelp -- commit --amend --no-edit hg amend githelp for git checkout -- . (checking out a directory) $ hg githelp -- checkout -- . note: use --no-backup to avoid creating .orig files hg revert . githelp for git checkout "HEAD^" (should still work to pass a rev) $ hg githelp -- checkout "HEAD^" hg update .^ githelp checkout: args after -- should be treated as paths no matter what $ hg githelp -- checkout -- HEAD note: use --no-backup to avoid creating .orig files hg revert HEAD githelp for git checkout with rev and path $ hg githelp -- checkout "HEAD^" -- file.txt note: use --no-backup to avoid creating .orig files hg revert -r .^ file.txt githelp for git with rev and path, without separator $ hg githelp -- checkout "HEAD^" file.txt note: use --no-backup to avoid creating .orig files hg revert -r .^ file.txt githelp for checkout with a file as first argument $ hg githelp -- checkout test_file note: use --no-backup to avoid creating .orig files hg revert test_file githelp for checkout with a removed file as first argument $ hg githelp -- checkout removed_file note: use --no-backup to avoid creating .orig files hg revert removed_file githelp for checkout with a deleted file as first argument $ hg githelp -- checkout deleted_file note: use --no-backup to avoid creating .orig files hg revert deleted_file githelp for checkout with a untracked file as first argument $ hg githelp -- checkout untracked_file note: use --no-backup to avoid creating .orig files hg revert untracked_file githelp for checkout with a directory as first argument $ hg githelp -- checkout dir note: use --no-backup to avoid creating .orig files hg revert dir githelp for checkout when not in repo root $ cd dir $ hg githelp -- checkout file note: use --no-backup to avoid creating .orig files hg revert file $ cd .. githelp for checkout with an argument that is both a file and a revision $ hg githelp -- checkout both hg update both githelp for checkout with the -p option $ hg githelp -- git checkout -p xyz hg revert -i -r xyz $ hg githelp -- git checkout -p xyz -- abc note: use --no-backup to avoid creating .orig files hg revert -i -r xyz abc githelp for checkout with the -f option and a rev $ hg githelp -- git checkout -f xyz hg update -C xyz $ hg githelp -- git checkout --force xyz hg update -C xyz githelp for checkout with the -f option without an arg $ hg githelp -- git checkout -f hg revert --all $ hg githelp -- git checkout --force hg revert --all githelp for grep with pattern and path $ hg githelp -- grep shrubbery flib/intern/ hg grep shrubbery flib/intern/ githelp for reset, checking ~ in git becomes ~1 in mercurial $ hg githelp -- reset HEAD~ hg update .~1 $ hg githelp -- reset "HEAD^" hg update .^ $ hg githelp -- reset HEAD~3 hg update .~3 $ hg githelp -- reset --mixed HEAD note: --mixed has no meaning since Mercurial has no staging area hg update . $ hg githelp -- reset --soft HEAD note: --soft has no meaning since Mercurial has no staging area hg update . $ hg githelp -- reset --hard HEAD hg update --clean . githelp for git show --name-status $ hg githelp -- git show --name-status hg log --style status -r . githelp for git show --pretty=format: --name-status $ hg githelp -- git show --pretty=format: --name-status hg status --change . githelp for show with no arguments $ hg githelp -- show hg export githelp for show with a path $ hg githelp -- show test_file hg cat test_file githelp for show with not a path: $ hg githelp -- show rev hg export rev githelp for show with many arguments $ hg githelp -- show argone argtwo hg export argone argtwo $ hg githelp -- show test_file argone argtwo hg cat test_file argone argtwo githelp for show with --unified options $ hg githelp -- show --unified=10 hg export --config diff.unified=10 $ hg githelp -- show -U100 hg export --config diff.unified=100 githelp for show with a path and --unified $ hg githelp -- show -U20 test_file hg cat test_file --config diff.unified=20 githelp for stash drop without name $ hg githelp -- git stash drop hg shelve -d <shelve name> githelp for stash drop with name $ hg githelp -- git stash drop xyz hg shelve -d xyz githelp for stash list with patch $ hg githelp -- git stash list -p hg shelve -l -p githelp for stash show $ hg githelp -- git stash show hg shelve --stat githelp for stash show with patch and name $ hg githelp -- git stash show -p mystash hg shelve -p mystash githelp for stash clear $ hg githelp -- git stash clear hg shelve --cleanup githelp for whatchanged should show deprecated message $ hg githelp -- whatchanged -p this command has been deprecated in the git project, thus isn't supported by this tool githelp for git branch -m renaming $ hg githelp -- git branch -m old new hg bookmark -m old new When the old name is omitted, git branch -m new renames the current branch. $ hg githelp -- git branch -m new hg bookmark -m `hg log -T"{activebookmark}" -r .` new Branch deletion in git strips commits $ hg githelp -- git branch -d hg strip -B $ hg githelp -- git branch -d feature hg strip -B feature -B $ hg githelp -- git branch --delete experiment1 experiment2 hg strip -B experiment1 -B experiment2 -B githelp for reuse message using the shorthand $ hg githelp -- git commit -C deadbeef hg commit -M deadbeef githelp for reuse message using the the long version $ hg githelp -- git commit --reuse-message deadbeef hg commit -M deadbeef githelp for reuse message using HEAD $ hg githelp -- git commit --reuse-message HEAD~ hg commit -M .~1 githelp for apply with no options $ hg githelp -- apply hg import --no-commit githelp for apply with directory strip custom $ hg githelp -- apply -p 5 hg import --no-commit -p 5 githelp for apply with prefix directory $ hg githelp -- apply --directory=modules hg import --no-commit --prefix modules git merge-base $ hg githelp -- git merge-base --is-ancestor ignoring unknown option --is-ancestor note: ancestors() is part of the revset language (learn more about revsets with 'hg help revsets') hg log -T '{node}\n' -r 'ancestor(A,B)' githelp for git blame $ hg githelp -- git blame hg annotate -udl githelp for add $ hg githelp -- git add hg add $ hg githelp -- git add -p note: Mercurial will commit when complete, as there is no staging area in Mercurial hg commit --interactive $ hg githelp -- git add --all note: use hg addremove to remove files that have been deleted hg add githelp for reflog $ hg githelp -- git reflog hg journal note: in hg commits can be deleted from repo but we always have backups $ hg githelp -- git reflog --all hg journal --all note: in hg commits can be deleted from repo but we always have backups