perf: allow to clear the obsstore in 'perfvolatilesets'
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 21 May 2017 13:32:07 +0200
changeset 32390 f90419a90cc3
parent 32389 4e51b2a99847
child 32391 3ea1f1e71a0a
perf: allow to clear the obsstore in 'perfvolatilesets' Loading the obsstore can become a large part of the time necessary to compute the important volatile set. We add a flag purging all known obsstore related data. For example, computing the 'bumped' set currently requires reading the full obsstore, so timing greatly differ with or without that flag: Without: ! bumped ! wall 0.005047 comb 0.000000 user 0.000000 sys 0.000000 (best of 446) With: ! bumped ! wall 0.512367 comb 0.510000 user 0.480000 sys 0.030000 (best of 15)
contrib/perf.py
--- a/contrib/perf.py	Sun May 21 13:49:48 2017 +0200
+++ b/contrib/perf.py	Sun May 21 13:32:07 2017 +0200
@@ -1129,7 +1129,15 @@
     timer(d)
     fm.end()
 
-@command('perfvolatilesets', formatteropts)
+def _clearobsstore(repo):
+    unfi = repo.unfiltered()
+    if 'obsstore' in vars(unfi):
+        del unfi.obsstore
+        del unfi._filecache['obsstore']
+
+@command('perfvolatilesets',
+         [('', 'clear-obsstore', False, 'drop obsstore between each call.'),
+         ] + formatteropts)
 def perfvolatilesets(ui, repo, *names, **opts):
     """benchmark the computation of various volatile set
 
@@ -1140,6 +1148,8 @@
     def getobs(name):
         def d():
             repo.invalidatevolatilesets()
+            if opts['clear_obsstore']:
+                _clearobsstore(repo)
             obsolete.getrevs(repo, name)
         return d
 
@@ -1153,6 +1163,8 @@
     def getfiltered(name):
         def d():
             repo.invalidatevolatilesets()
+            if opts['clear_obsstore']:
+                _clearobsstore(repo)
             repoview.filterrevs(repo, name)
         return d