Skip to content
Snippets Groups Projects
Commit 99c42969 authored by Siddharth Agarwal's avatar Siddharth Agarwal
Browse files

hggitperf: add a command to measure the perf of saving the foldmap

parent be105c4d
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
''' '''
from mercurial import cmdutil from mercurial import cmdutil
import time, os import time, os, tempfile
import functools import functools
cmdtable = {} cmdtable = {}
...@@ -69,3 +69,15 @@ ...@@ -69,3 +69,15 @@
timer, fm = gettimer(ui) timer, fm = gettimer(ui)
timer(repo.githandler.load_map) timer(repo.githandler.load_map)
fm.end() 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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment