Mercurial > hg
changeset 18240:a8318715d8bb
perftest: add a command to benchmark construction of volatile cache
Obsolescence and filtering related caches are critical. Having a handy way to
check them is valuable.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Fri, 04 Jan 2013 19:23:26 +0100 |
parents | a95f1d619bb7 |
children | f5ed27c51995 |
files | contrib/perf.py |
diffstat | 1 files changed, 27 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Fri Jan 04 19:22:40 2013 +0100 +++ b/contrib/perf.py Fri Jan 04 19:23:26 2013 +0100 @@ -1,7 +1,8 @@ # perf.py - performance test routines '''helper extension to measure performance''' -from mercurial import cmdutil, scmutil, util, match, commands +from mercurial import cmdutil, scmutil, util, match, commands, obsolete +from mercurial import repoview import time, os, sys cmdtable = {} @@ -275,3 +276,28 @@ repo.invalidatevolatilesets() repo.revs(expr) timer(d) + +@command('perfvolatilesets') +def perfvolatilesets(ui, repo): + """benchmark the computation of various volatile set + + Volatile set computes element related to filtering and obsolescence.""" + repo = repo.unfiltered() + + def getobs(name): + def d(): + repo.invalidatevolatilesets() + obsolete.getrevs(repo, name) + return d + + for name in sorted(obsolete.cachefuncs): + timer(getobs(name), title=name) + + def getfiltered(name): + def d(): + repo.invalidatevolatilesets() + repoview.filteredrevs(repo, name) + return d + + for name in sorted(repoview.filtertable): + timer(getfiltered(name), title=name)