Mercurial > hg
view contrib/debugshell.py @ 50671:e06d1a779eb6
store: stop relying on a `revlog_type` property
We want to know if a file is related to a revlog, but the rest is dealt with
differently already, so we simplify things further.
as a bonus, this cleanup This provides a small but noticeable speedup.
The number below use `hg perf::stream-locked-section` to measure the time spend
in the locked section of the streaming clone. Number are run on various
repository and compare different steps.:
1) the effect of this patchs,
2) the effect of the cleanup series,
2) current state compared to because large refactoring.
All benchmarks are run on linux with Python 3.10.7.
### Effect of this patch
# mercurial-2018-08-01-zstd-sparse-revlog
# benchmark.name = perf-stream-locked-section
before: 0.030246 seconds
after: 0.029274 seconds (-3.21%)
# pypy-2018-08-01-zstd-sparse-revlog
before: 0.545012 seconds
after: 0.520872 seconds (-4.43%)
# netbeans-2018-08-01-zstd-sparse-revlog
before: 2.719939 seconds
after: 2.626791 seconds (-3.42%)
# mozilla-central-2018-08-01-zstd-sparse-revlog
before: 6.304179 seconds
after: 6.096700 seconds (-3.29%)
# mozilla-try-2019-02-18-zstd-sparse-revlog
before: 14.142687 seconds
after: 13.640779 seconds (-3.55%)
### Effect of this series
A small but sizeable speedup
# mercurial-2018-08-01-zstd-sparse-revlog
before: 0.031122 seconds
after: 0.029274 seconds (-5.94%)
# pypy-2018-08-01-zstd-sparse-revlog
before: 0.589970 seconds
after: 0.520872 seconds (-11.71%)
# netbeans-2018-08-01-zstd-sparse-revlog
before: 2.980300 seconds
after: 2.626791 seconds (-11.86%)
# mozilla-central-2018-08-01-zstd-sparse-revlog
before: 6.863204 seconds
after: 6.096700 seconds (-11.17%)
# mozilla-try-2019-02-18-zstd-sparse-revlog
before: 14.921393 seconds
after: 13.640779 seconds (-8.58%)
### Current state compared to the pre-refactoring state
The refactoring introduced multiple string manipulation and dictionary creation
that seems to induce a signifiant slowdown
Slowdown
# mercurial-2018-08-01-zstd-sparse-revlog
6.4.3: 0.019459 seconds
after: 0.029274 seconds (+50.44%)
## pypy-2018-08-01-zstd-sparse-revlog
6.4.3: 0.290715 seconds
after: 0.520872 seconds (+79.17%)
# netbeans-2018-08-01-zstd-sparse-revlog
6.4.3: 1.403447 seconds
after: 2.626791 seconds (+87.17%)
# mozilla-central-2018-08-01-zstd-sparse-revlog
6.4.3: 3.163549 seconds
after: 6.096700 seconds (+92.72%)
# mozilla-try-2019-02-18-zstd-sparse-revlog
6.4.3: 6.702184 seconds
after: 13.640779 seconds (+103.53%)
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 30 May 2023 17:43:59 +0100 |
parents | 6000f5b25c9b |
children |
line wrap: on
line source
# debugshell extension """a python shell with repo, changelog & manifest objects""" import code import mercurial import sys from mercurial import ( demandimport, pycompat, registrar, ) cmdtable = {} command = registrar.command(cmdtable) def pdb(ui, repo, msg, **opts): objects = { 'mercurial': mercurial, 'repo': repo, 'cl': repo.changelog, 'mf': repo.manifestlog, } code.interact(msg, local=objects) def ipdb(ui, repo, msg, **opts): import IPython cl = repo.changelog mf = repo.manifestlog cl, mf # use variables to appease pyflakes IPython.embed() @command(b'debugshell|dbsh', []) def debugshell(ui, repo, **opts): bannermsg = "loaded repo : %s\n" "using source: %s" % ( pycompat.sysstr(repo.root), mercurial.__path__[0], ) pdbmap = {'pdb': 'code', 'ipdb': 'IPython'} debugger = ui.config(b"ui", b"debugger") if not debugger: debugger = 'pdb' else: debugger = pycompat.sysstr(debugger) # if IPython doesn't exist, fallback to code.interact try: with demandimport.deactivated(): __import__(pdbmap[debugger]) except ImportError: ui.warnnoi18n( b"%s debugger specified but %s module was not found\n" % (debugger, pdbmap[debugger]) ) debugger = b'pdb' getattr(sys.modules[__name__], debugger)(ui, repo, bannermsg, **opts)