Patchwork [4,of,5] perf: clear revlog caches on every iteration

login
register
mail settings
Submitter Gregory Szorc
Date May 6, 2017, 6:22 p.m.
Message ID <cff951b580bade53bb5a.1494094920@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/20489/
State Accepted
Headers show

Comments

Gregory Szorc - May 6, 2017, 6:22 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1494094556 25200
#      Sat May 06 11:15:56 2017 -0700
# Node ID cff951b580bade53bb5a520b690feb5ca73361d7
# Parent  4ba2d6cb2cb76a5c18ed20ae3ee0f89f2a50eb72
perf: clear revlog caches on every iteration

cmdutil.openrevlog() may return a cached revlog instance. This /may/
be a recent "regression" due to refactoring of the manifest API. I'm
not sure.

Either way, this perf command was broken for at least manifests because
subsequent invocations of the perf function would get cache hits from
previous invocations, invalidating results. In the extreme case,
testing the last revision in the revlog resulted in near-instantanous
execution of subsequent runs (since the fulltext is cached). A time
of ~1us would be reported in this case.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -855,6 +855,7 @@  def perfrevlog(ui, repo, file_=None, sta
 
     def d():
         r = cmdutil.openrevlog(repo, 'perfrevlog', file_, opts)
+        r.clearcaches()
 
         beginrev = startrev
         endrev = _len(r)