# HG changeset patch # User Siddharth Agarwal # Date 1428636907 25200 # Node ID 99c42969417f9b3a7ba63afba676408a9a8a04e3 # Parent be105c4dda7ba27a47061a31b77fb5d1b5a04363 hggitperf: add a command to measure the perf of saving the foldmap diff --git a/contrib/hggitperf.py b/contrib/hggitperf.py --- a/contrib/hggitperf.py +++ b/contrib/hggitperf.py @@ -6,7 +6,7 @@ ''' from mercurial import cmdutil -import time, os +import time, os, tempfile import functools cmdtable = {} @@ -69,3 +69,15 @@ timer, fm = gettimer(ui) timer(repo.githandler.load_map) fm.end() + +@command('perfgitsavemap') +def perfgitsavemap(ui, repo): + timer, fm = gettimer(ui) + repo.githandler.load_map() + fd, f = tempfile.mkstemp(prefix='.git-mapfile-', dir=repo.path) + basename = os.path.basename(f) + try: + timer(lambda: repo.githandler.save_map(basename)) + finally: + os.unlink(f) + fm.end()