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

login
register
mail settings
Submitter Pierre-Yves David
Date March 27, 2014, 2:49 a.m.
Message ID <d7da7e3d580cf0239b4f.1395888542@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4080/
State Accepted
Commit b581c5827516ac14fb30c2ca1df9a4b153fac919
Headers show

Comments

Pierre-Yves David - March 27, 2014, 2:49 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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