[PATCH 3 of 3] perfchangelog: add 'perfchangelog' command
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue May 23 10:04:23 EDT 2017
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1495499078 -7200
# Tue May 23 02:24:38 2017 +0200
# Node ID 73e20c262b133cf3117a7148e6293b5721e8930d
# Parent c79b8f2a95a35ce1b41325d003337c65bc5bffca
# EXP-Topic perf
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
# hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 73e20c262b13
perfchangelog: add 'perfchangelog' command
That command monitor the time spend initializing a new changelog object.
If I'm not mistaken this includes reading the file on disk and building the
nodemap.
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -488,6 +488,22 @@ def perfchangegroupchangelog(ui, repo, v
timer(d)
fm.end()
+def _clearchangelog(repo):
+ if 'changelog' in vars(repo):
+ del repo.changelog
+ del repo._filecache['changelog']
+
+ at command('perfchangelog', [], "")
+def perfchangelog(ui, repo, **opts):
+ """benchmark the changelog initialization"""
+ timer, fm = gettimer(ui, opts)
+ repo = repo.unfiltered()
+ def d():
+ _clearchangelog(repo)
+ repo.changelog
+ timer(d)
+ fm.end()
+
@command('perfdirs', formatteropts)
def perfdirs(ui, repo, **opts):
timer, fm = gettimer(ui, opts)
diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t
--- a/tests/test-contrib-perf.t
+++ b/tests/test-contrib-perf.t
@@ -56,6 +56,8 @@ perfstatus
perfcca (no help text available)
perfchangegroupchangelog
Benchmark producing a changelog group for a changegroup.
+ perfchangelog
+ benchmark the changelog initialization
perfchangeset
(no help text available)
perfctxfiles (no help text available)
More information about the Mercurial-devel
mailing list