Mercurial > hg
view tests/test-devel-warnings.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 | 1de3364320af |
children | 54d5424da623 |
line wrap: on
line source
$ cat << EOF > buggylocking.py > """A small extension that tests our developer warnings > """ > > from mercurial import error, registrar, repair, util > > cmdtable = {} > command = registrar.command(cmdtable) > > @command(b'buggylocking', [], '') > def buggylocking(ui, repo): > lo = repo.lock() > wl = repo.wlock() > wl.release() > lo.release() > > @command(b'buggytransaction', [], '') > def buggylocking(ui, repo): > tr = repo.transaction(b'buggy') > # make sure we rollback the transaction as we don't want to rely on the__del__ > tr.release() > > @command(b'properlocking', [], '') > def properlocking(ui, repo): > """check that reentrance is fine""" > wl = repo.wlock() > lo = repo.lock() > tr = repo.transaction(b'proper') > tr2 = repo.transaction(b'proper') > lo2 = repo.lock() > wl2 = repo.wlock() > wl2.release() > lo2.release() > tr2.close() > tr.close() > lo.release() > wl.release() > > @command(b'nowaitlocking', [], '') > def nowaitlocking(ui, repo): > lo = repo.lock() > wl = repo.wlock(wait=False) > wl.release() > lo.release() > > @command(b'no-wlock-write', [], '') > def nowlockwrite(ui, repo): > with repo.vfs(b'branch', b'a'): > pass > > @command(b'no-lock-write', [], '') > def nolockwrite(ui, repo): > with repo.svfs(b'fncache', b'a'): > pass > > @command(b'stripintr', [], '') > def stripintr(ui, repo): > lo = repo.lock() > tr = repo.transaction(b'foobar') > try: > repair.strip(repo.ui, repo, [repo[b'.'].node()]) > finally: > lo.release() > @command(b'oldanddeprecated', [], '') > def oldanddeprecated(ui, repo): > """test deprecation warning API""" > def foobar(ui): > ui.deprecwarn(b'foorbar is deprecated, go shopping', b'42.1337') > foobar(ui) > @command(b'nouiwarning', [], '') > def nouiwarning(ui, repo): > util.nouideprecwarn(b'this is a test', b'13.37') > @command(b'programmingerror', [], '') > def programmingerror(ui, repo): > raise error.ProgrammingError(b'something went wrong', hint=b'try again') > EOF $ cat << EOF >> $HGRCPATH > [extensions] > buggylocking=$TESTTMP/buggylocking.py > mock=$TESTDIR/mockblackbox.py > blackbox= > [devel] > all-warnings=1 > [blackbox] > track = command, commandexception, commandfinish, develwarn > EOF $ hg init lock-checker $ cd lock-checker $ hg buggylocking devel-warn: "wlock" acquired after "lock" at: $TESTTMP/buggylocking.py:* (buggylocking) (glob) $ cat << EOF >> $HGRCPATH > [devel] > all=0 > check-locks=1 > EOF $ hg buggylocking devel-warn: "wlock" acquired after "lock" at: $TESTTMP/buggylocking.py:* (buggylocking) (glob) #if no-chg $ hg buggylocking --traceback devel-warn: "wlock" acquired after "lock" at: */hg:* in <module> (glob) (?) */mercurial/dispatch.py:* in run (glob) */mercurial/dispatch.py:* in dispatch (glob) */mercurial/dispatch.py:* in _runcatch (glob) */mercurial/dispatch.py:* in _callcatch (glob) */mercurial/scmutil.py* in callcatch (glob) */mercurial/dispatch.py:* in _runcatchfunc (glob) */mercurial/dispatch.py:* in _dispatch (glob) */mercurial/dispatch.py:* in runcommand (glob) */mercurial/dispatch.py:* in _runcommand (glob) */mercurial/dispatch.py:* in <lambda> (glob) */mercurial/util.py:* in check (glob) $TESTTMP/buggylocking.py:* in buggylocking (glob) #else $ hg buggylocking --traceback devel-warn: "wlock" acquired after "lock" at: */hg:* in <module> (glob) (?) */mercurial/dispatch.py:* in run (glob) */mercurial/dispatch.py:* in dispatch (glob) */mercurial/dispatch.py:* in _runcatch (glob) */mercurial/dispatch.py:* in _callcatch (glob) */mercurial/scmutil.py:* in callcatch (glob) */mercurial/dispatch.py:* in _runcatchfunc (glob) */mercurial/dispatch.py:* in _dispatch (glob) */mercurial/dispatch.py:* in runcommand (glob) */mercurial/dispatch.py:* in _runcommand (glob) */mercurial/dispatch.py:* in <lambda> (glob) */mercurial/util.py:* in check (glob) */mercurial/commands.py:* in serve (glob) */mercurial/server.py:* in runservice (glob) */mercurial/commandserver.py:* in run (glob) */mercurial/commandserver.py:* in _mainloop (glob) */mercurial/commandserver.py:* in _runworker (glob) */mercurial/commandserver.py:* in _serverequest (glob) */mercurial/commandserver.py:* in serve (glob) */mercurial/commandserver.py:* in serveone (glob) */mercurial/chgserver.py:* in runcommand (glob) */mercurial/commandserver.py:* in runcommand (glob) */mercurial/dispatch.py:* in dispatch (glob) */mercurial/dispatch.py:* in _runcatch (glob) */mercurial/dispatch.py:* in _callcatch (glob) */mercurial/scmutil.py:* in callcatch (glob) */mercurial/dispatch.py:* in _runcatchfunc (glob) */mercurial/dispatch.py:* in _dispatch (glob) */mercurial/dispatch.py:* in runcommand (glob) */mercurial/dispatch.py:* in _runcommand (glob) */mercurial/dispatch.py:* in <lambda> (glob) */mercurial/util.py:* in check (glob) $TESTTMP/buggylocking.py:* in buggylocking (glob) #endif $ hg properlocking $ hg nowaitlocking Writing without lock $ hg no-wlock-write devel-warn: write with no wlock: "branch" at: $TESTTMP/buggylocking.py:* (nowlockwrite) (glob) $ hg no-lock-write devel-warn: write with no lock: "fncache" at: $TESTTMP/buggylocking.py:* (nolockwrite) (glob) Stripping from a transaction $ echo a > a $ hg add a $ hg commit -m a $ hg stripintr 2>&1 | egrep -v '^(\*\*| )' Traceback (most recent call last): *ProgrammingError: cannot strip from inside a transaction (glob) $ hg oldanddeprecated devel-warn: foorbar is deprecated, go shopping (compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:* (oldanddeprecated) (glob) #if no-chg $ hg oldanddeprecated --traceback devel-warn: foorbar is deprecated, go shopping (compatibility will be dropped after Mercurial-42.1337, update your code.) at: */hg:* in <module> (glob) (?) */mercurial/dispatch.py:* in run (glob) */mercurial/dispatch.py:* in dispatch (glob) */mercurial/dispatch.py:* in _runcatch (glob) */mercurial/dispatch.py:* in _callcatch (glob) */mercurial/scmutil.py* in callcatch (glob) */mercurial/dispatch.py:* in _runcatchfunc (glob) */mercurial/dispatch.py:* in _dispatch (glob) */mercurial/dispatch.py:* in runcommand (glob) */mercurial/dispatch.py:* in _runcommand (glob) */mercurial/dispatch.py:* in <lambda> (glob) */mercurial/util.py:* in check (glob) $TESTTMP/buggylocking.py:* in oldanddeprecated (glob) #else $ hg oldanddeprecated --traceback devel-warn: foorbar is deprecated, go shopping (compatibility will be dropped after Mercurial-42.1337, update your code.) at: */hg:* in <module> (glob) */mercurial/dispatch.py:* in run (glob) */mercurial/dispatch.py:* in dispatch (glob) */mercurial/dispatch.py:* in _runcatch (glob) */mercurial/dispatch.py:* in _callcatch (glob) */mercurial/scmutil.py:* in callcatch (glob) */mercurial/dispatch.py:* in _runcatchfunc (glob) */mercurial/dispatch.py:* in _dispatch (glob) */mercurial/dispatch.py:* in runcommand (glob) */mercurial/dispatch.py:* in _runcommand (glob) */mercurial/dispatch.py:* in <lambda> (glob) */mercurial/util.py:* in check (glob) */mercurial/commands.py:* in serve (glob) */mercurial/server.py:* in runservice (glob) */mercurial/commandserver.py:* in run (glob) */mercurial/commandserver.py:* in _mainloop (glob) */mercurial/commandserver.py:* in _runworker (glob) */mercurial/commandserver.py:* in _serverequest (glob) */mercurial/commandserver.py:* in serve (glob) */mercurial/commandserver.py:* in serveone (glob) */mercurial/chgserver.py:* in runcommand (glob) */mercurial/commandserver.py:* in runcommand (glob) */mercurial/dispatch.py:* in dispatch (glob) */mercurial/dispatch.py:* in _runcatch (glob) */mercurial/dispatch.py:* in _callcatch (glob) */mercurial/scmutil.py:* in callcatch (glob) */mercurial/dispatch.py:* in _runcatchfunc (glob) */mercurial/dispatch.py:* in _dispatch (glob) */mercurial/dispatch.py:* in runcommand (glob) */mercurial/dispatch.py:* in _runcommand (glob) */mercurial/dispatch.py:* in <lambda> (glob) */mercurial/util.py:* in check (glob) $TESTTMP/buggylocking.py:* in oldanddeprecated (glob) #endif #if no-chg $ hg blackbox -l 7 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping (compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:* (oldanddeprecated) (glob) 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated exited 0 after * seconds (glob) 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping (compatibility will be dropped after Mercurial-42.1337, update your code.) at: */hg:* in <module> (glob) (?) */mercurial/dispatch.py:* in run (glob) */mercurial/dispatch.py:* in dispatch (glob) */mercurial/dispatch.py:* in _runcatch (glob) */mercurial/dispatch.py:* in _callcatch (glob) */mercurial/scmutil.py* in callcatch (glob) */mercurial/dispatch.py:* in _runcatchfunc (glob) */mercurial/dispatch.py:* in _dispatch (glob) */mercurial/dispatch.py:* in runcommand (glob) */mercurial/dispatch.py:* in _runcommand (glob) */mercurial/dispatch.py:* in <lambda> (glob) */mercurial/util.py:* in check (glob) $TESTTMP/buggylocking.py:* in oldanddeprecated (glob) 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback exited 0 after * seconds (glob) 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> blackbox -l 7 #else $ hg blackbox -l 7 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping (compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:* (oldanddeprecated) (glob) 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated exited 0 after * seconds (glob) 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping (compatibility will be dropped after Mercurial-42.1337, update your code.) at: */hg:* in <module> (glob) */mercurial/dispatch.py:* in run (glob) */mercurial/dispatch.py:* in dispatch (glob) */mercurial/dispatch.py:* in _runcatch (glob) */mercurial/dispatch.py:* in _callcatch (glob) */mercurial/scmutil.py:* in callcatch (glob) */mercurial/dispatch.py:* in _runcatchfunc (glob) */mercurial/dispatch.py:* in _dispatch (glob) */mercurial/dispatch.py:* in runcommand (glob) */mercurial/dispatch.py:* in _runcommand (glob) */mercurial/dispatch.py:* in <lambda> (glob) */mercurial/util.py:* in check (glob) */mercurial/commands.py:* in serve (glob) */mercurial/server.py:* in runservice (glob) */mercurial/commandserver.py:* in run (glob) */mercurial/commandserver.py:* in _mainloop (glob) */mercurial/commandserver.py:* in _runworker (glob) */mercurial/commandserver.py:* in _serverequest (glob) */mercurial/commandserver.py:* in serve (glob) */mercurial/commandserver.py:* in serveone (glob) */mercurial/chgserver.py:* in runcommand (glob) */mercurial/commandserver.py:* in runcommand (glob) */mercurial/dispatch.py:* in dispatch (glob) */mercurial/dispatch.py:* in _runcatch (glob) */mercurial/dispatch.py:* in _callcatch (glob) */mercurial/scmutil.py:* in callcatch (glob) */mercurial/dispatch.py:* in _runcatchfunc (glob) */mercurial/dispatch.py:* in _dispatch (glob) */mercurial/dispatch.py:* in runcommand (glob) */mercurial/dispatch.py:* in _runcommand (glob) */mercurial/dispatch.py:* in <lambda> (glob) */mercurial/util.py:* in check (glob) $TESTTMP/buggylocking.py:* in oldanddeprecated (glob) 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback exited 0 after * seconds (glob) 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> blackbox -l 7 #endif Test programming error failure: $ hg buggytransaction 2>&1 | egrep -v '^ ' ** Unknown exception encountered with possibly-broken third-party extension buggylocking ** which supports versions unknown of Mercurial. ** Please disable buggylocking and try your action again. ** If that fixes the bug please report it to the extension author. ** Python * (glob) ** Mercurial Distributed SCM (*) (glob) ** Extensions loaded: * (glob) ** ProgrammingError: transaction requires locking Traceback (most recent call last): *ProgrammingError: transaction requires locking (glob) $ hg programmingerror 2>&1 | egrep -v '^ ' ** Unknown exception encountered with possibly-broken third-party extension buggylocking ** which supports versions unknown of Mercurial. ** Please disable buggylocking and try your action again. ** If that fixes the bug please report it to the extension author. ** Python * (glob) ** Mercurial Distributed SCM (*) (glob) ** Extensions loaded: * (glob) ** ProgrammingError: something went wrong ** (try again) Traceback (most recent call last): *ProgrammingError: something went wrong (glob) Old style deprecation warning $ hg nouiwarning $TESTTMP/buggylocking.py:*: DeprecationWarning: this is a test (glob) (compatibility will be dropped after Mercurial-13.37, update your code.) util.nouideprecwarn(b'this is a test', b'13.37') (disabled outside of test run) $ HGEMITWARNINGS= hg nouiwarning Test warning on config option access and registration $ cat << EOF > ${TESTTMP}/buggyconfig.py > """A small extension that tests our developer warnings for config""" > > from mercurial import configitems, registrar > > cmdtable = {} > command = registrar.command(cmdtable) > > configtable = {} > configitem = registrar.configitem(configtable) > > configitem(b'test', b'some', default=b'foo') > configitem(b'test', b'dynamic', default=configitems.dynamicdefault) > configitem(b'test', b'callable', default=list) > # overwrite a core config > configitem(b'ui', b'quiet', default=False) > configitem(b'ui', b'interactive', default=None) > > @command(b'buggyconfig') > def cmdbuggyconfig(ui, repo): > repo.ui.config(b'ui', b'quiet', True) > repo.ui.config(b'ui', b'interactive', False) > repo.ui.config(b'test', b'some', b'bar') > repo.ui.config(b'test', b'some', b'foo') > repo.ui.config(b'test', b'dynamic', b'some-required-default') > repo.ui.config(b'test', b'dynamic') > repo.ui.config(b'test', b'callable', []) > repo.ui.config(b'test', b'callable', b'foo') > repo.ui.config(b'test', b'unregistered') > repo.ui.config(b'unregistered', b'unregistered') > EOF $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" buggyconfig devel-warn: extension 'buggyconfig' overwrite config item 'ui.interactive' at: */mercurial/extensions.py:* (_loadextra) (glob) devel-warn: extension 'buggyconfig' overwrite config item 'ui.quiet' at: */mercurial/extensions.py:* (_loadextra) (glob) devel-warn: specifying a mismatched default value for a registered config item: 'ui.quiet' 'True' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) devel-warn: specifying a mismatched default value for a registered config item: 'ui.interactive' 'False' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) devel-warn: specifying a mismatched default value for a registered config item: 'test.some' 'bar' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) devel-warn: config item requires an explicit default value: 'test.dynamic' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) devel-warn: specifying a mismatched default value for a registered config item: 'test.callable' 'foo' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) devel-warn: accessing unregistered config item: 'test.unregistered' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) devel-warn: accessing unregistered config item: 'unregistered.unregistered' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) $ cd ..