[PATCH 1 of 9] perf: unroll the result in perfrevset

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Wed Mar 26 21:49:02 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1395879911 25200
#      Wed Mar 26 17:25:11 2014 -0700
# Node ID d7da7e3d580cf0239b4fdf012a2647c93a2ee1d9
# Parent  5d859e949ce867db1439448f6ea2bb3745252768
perf: unroll the result in perfrevset

With the new lazy revset implementation, we need to actually read all elements
to trigger all the computations. Otherwise a no-op if of course much faster than
the full work.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -333,11 +333,11 @@ def perfrevset(ui, repo, expr, clear=Fal
     revisions set cache on the revset execution. Volatile cache hold filtered
     and obsolete related cache."""
     def d():
         if clear:
             repo.invalidatevolatilesets()
-        repo.revs(expr)
+        for r in repo.revs(expr): pass
     timer(d)
 
 @command('perfvolatilesets')
 def perfvolatilesets(ui, repo, *names):
     """benchmark the computation of various volatile set


More information about the Mercurial-devel mailing list