Mercurial > hg
view tests/test-hgrc.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 | eecc005229ff |
children | 28aacddf3af0 |
line wrap: on
line source
Use hgrc within $TESTTMP $ HGRCPATH=`pwd`/hgrc $ export HGRCPATH hide outer repo $ hg init Use an alternate var for scribbling on hgrc to keep check-code from complaining about the important settings we may be overwriting: $ HGRC=`pwd`/hgrc $ export HGRC Basic syntax error $ echo "invalid" > $HGRC $ hg version hg: parse error at $TESTTMP/hgrc:1: invalid [255] $ echo "" > $HGRC Issue1199: Can't use '%' in hgrc (eg url encoded username) $ hg init "foo%bar" $ hg clone "foo%bar" foobar updating to branch default 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd foobar $ cat .hg/hgrc # example repository config (see 'hg help config' for more info) [paths] default = $TESTTMP/foo%bar # path aliases to other clones of this repo in URLs or filesystem paths # (see 'hg help config.paths' for more info) # # default:pushurl = ssh://jdoe@example.net/hg/jdoes-fork # my-fork = ssh://jdoe@example.net/hg/jdoes-fork # my-clone = /home/jdoe/jdoes-clone [ui] # name and email (local to this repository, optional), e.g. # username = Jane Doe <jdoe@example.com> $ hg paths default = $TESTTMP/foo%bar $ hg showconfig bundle.mainreporoot=$TESTTMP/foobar paths.default=$TESTTMP/foo%bar $ cd .. Check %include $ echo '[section]' > $TESTTMP/included $ echo 'option = value' >> $TESTTMP/included $ echo '%include $TESTTMP/included' >> $HGRC $ hg showconfig section section.option=value #if no-windows $ chmod u-r $TESTTMP/included $ hg showconfig section hg: parse error at $TESTTMP/hgrc:2: cannot include $TESTTMP/included (Permission denied) [255] #endif issue1829: wrong indentation $ echo '[foo]' > $HGRC $ echo ' x = y' >> $HGRC $ hg version hg: parse error at $TESTTMP/hgrc:2: x = y unexpected leading whitespace [255] $ "$PYTHON" -c "from __future__ import print_function; print('[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n')" \ > > $HGRC $ hg showconfig foo foo.bar=a\nb\nc\nde\nfg foo.baz=bif cb $ FAKEPATH=/path/to/nowhere $ export FAKEPATH $ echo '%include $FAKEPATH/no-such-file' > $HGRC $ hg version Mercurial Distributed SCM (version *) (glob) (see https://mercurial-scm.org for more information) Copyright (C) 2005-* Matt Mackall and others (glob) This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ unset FAKEPATH make sure global options given on the cmdline take precedence $ hg showconfig --config ui.verbose=True --quiet bundle.mainreporoot=$TESTTMP ui.verbose=False ui.debug=False ui.quiet=True $ touch foobar/untracked $ cat >> foobar/.hg/hgrc <<EOF > [ui] > verbose=True > EOF $ hg -R foobar st -q username expansion $ olduser=$HGUSER $ unset HGUSER $ FAKEUSER='John Doe' $ export FAKEUSER $ echo '[ui]' > $HGRC $ echo 'username = $FAKEUSER' >> $HGRC $ hg init usertest $ cd usertest $ touch bar $ hg commit --addremove --quiet -m "added bar" $ hg log --template "{author}\n" John Doe $ cd .. $ hg showconfig bundle.mainreporoot=$TESTTMP ui.username=$FAKEUSER $ unset FAKEUSER $ HGUSER=$olduser $ export HGUSER showconfig with multiple arguments $ echo "[alias]" > $HGRC $ echo "log = log -g" >> $HGRC $ echo "[defaults]" >> $HGRC $ echo "identify = -n" >> $HGRC $ hg showconfig alias defaults alias.log=log -g defaults.identify=-n $ hg showconfig alias alias alias.log=log -g $ hg showconfig alias.log alias.log alias.log=log -g $ hg showconfig alias defaults.identify alias.log=log -g defaults.identify=-n $ hg showconfig alias.log defaults.identify alias.log=log -g defaults.identify=-n HGPLAIN $ echo "[ui]" > $HGRC $ echo "debug=true" >> $HGRC $ echo "fallbackencoding=ASCII" >> $HGRC $ echo "quiet=true" >> $HGRC $ echo "slash=true" >> $HGRC $ echo "traceback=true" >> $HGRC $ echo "verbose=true" >> $HGRC $ echo "style=~/.hgstyle" >> $HGRC $ echo "logtemplate={node}" >> $HGRC $ echo "[defaults]" >> $HGRC $ echo "identify=-n" >> $HGRC $ echo "[alias]" >> $HGRC $ echo "log=log -g" >> $HGRC customized hgrc $ hg showconfig read config from: $TESTTMP/hgrc $TESTTMP/hgrc:13: alias.log=log -g repo: bundle.mainreporoot=$TESTTMP $TESTTMP/hgrc:11: defaults.identify=-n $TESTTMP/hgrc:2: ui.debug=true $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII $TESTTMP/hgrc:4: ui.quiet=true $TESTTMP/hgrc:5: ui.slash=true $TESTTMP/hgrc:6: ui.traceback=true $TESTTMP/hgrc:7: ui.verbose=true $TESTTMP/hgrc:8: ui.style=~/.hgstyle $TESTTMP/hgrc:9: ui.logtemplate={node} plain hgrc $ HGPLAIN=; export HGPLAIN $ hg showconfig --config ui.traceback=True --debug read config from: $TESTTMP/hgrc repo: bundle.mainreporoot=$TESTTMP --config: ui.traceback=True --verbose: ui.verbose=False --debug: ui.debug=True --quiet: ui.quiet=False with environment variables $ PAGER=p1 EDITOR=e1 VISUAL=e2 hg showconfig --debug read config from: $TESTTMP/hgrc repo: bundle.mainreporoot=$TESTTMP $PAGER: pager.pager=p1 $VISUAL: ui.editor=e2 --verbose: ui.verbose=False --debug: ui.debug=True --quiet: ui.quiet=False plain mode with exceptions $ cat > plain.py <<EOF > from mercurial import commands, extensions > def _config(orig, ui, repo, *values, **opts): > ui.write(b'plain: %r\n' % ui.plain()) > return orig(ui, repo, *values, **opts) > def uisetup(ui): > extensions.wrapcommand(commands.table, b'config', _config) > EOF $ echo "[extensions]" >> $HGRC $ echo "plain=./plain.py" >> $HGRC $ HGPLAINEXCEPT=; export HGPLAINEXCEPT $ hg showconfig --config ui.traceback=True --debug plain: True read config from: $TESTTMP/hgrc repo: bundle.mainreporoot=$TESTTMP $TESTTMP/hgrc:15: extensions.plain=./plain.py --config: ui.traceback=True --verbose: ui.verbose=False --debug: ui.debug=True --quiet: ui.quiet=False $ unset HGPLAIN $ hg showconfig --config ui.traceback=True --debug plain: True read config from: $TESTTMP/hgrc repo: bundle.mainreporoot=$TESTTMP $TESTTMP/hgrc:15: extensions.plain=./plain.py --config: ui.traceback=True --verbose: ui.verbose=False --debug: ui.debug=True --quiet: ui.quiet=False $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT $ hg showconfig --config ui.traceback=True --debug plain: True read config from: $TESTTMP/hgrc repo: bundle.mainreporoot=$TESTTMP $TESTTMP/hgrc:15: extensions.plain=./plain.py --config: ui.traceback=True --verbose: ui.verbose=False --debug: ui.debug=True --quiet: ui.quiet=False source of paths is not mangled $ cat >> $HGRCPATH <<EOF > [paths] > foo = bar > EOF $ hg showconfig --debug paths plain: True read config from: $TESTTMP/hgrc $TESTTMP/hgrc:17: paths.foo=$TESTTMP/bar Test we can skip the user configuration $ cat >> .hg/hgrc <<EOF > [paths] > elephant = babar > EOF $ hg path elephant = $TESTTMP/babar foo = $TESTTMP/bar $ HGRCSKIPREPO=1 hg path foo = $TESTTMP/bar $ cat >> .hg/hgrc <<EOF > [broken > EOF $ hg path hg: parse error at $TESTTMP/.hg/hgrc:3: [broken [255] $ HGRCSKIPREPO=1 hg path foo = $TESTTMP/bar Check that hgweb respect HGRCSKIPREPO=1 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log hg: parse error at $TESTTMP/.hg/hgrc:3: [broken [255] $ test -f hg.pid && (cat hg.pid >> $DAEMON_PIDS) [1] $ killdaemons.py $ test -f access.log && cat access.log [1] $ test -f errors.log && cat errors.log [1] $ HGRCSKIPREPO=1 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log $ cat hg.pid >> $DAEMON_PIDS $ killdaemons.py $ cat access.log $ cat errors.log Check that zeroconf respect HGRCSKIPREPO=1 $ hg paths --config extensions.zeroconf= hg: parse error at $TESTTMP/.hg/hgrc:3: [broken [255] $ HGRCSKIPREPO=1 hg paths --config extensions.zeroconf= foo = $TESTTMP/bar