contrib/perf.py
changeset 30145 113aa6145020
parent 30144 14031d183048
child 30146 148ccd1d9f2f
equal deleted inserted replaced
30144:14031d183048 30145:113aa6145020
   882     if not full:
   882     if not full:
   883         for name in allfilters:
   883         for name in allfilters:
   884             repo.filtered(name).branchmap()
   884             repo.filtered(name).branchmap()
   885     # add unfiltered
   885     # add unfiltered
   886     allfilters.append(None)
   886     allfilters.append(None)
   887     oldread = branchmap.read
   887 
   888     oldwrite = branchmap.branchcache.write
   888     branchcacheread = safeattrsetter(branchmap, 'read')
       
   889     branchcachewrite = safeattrsetter(branchmap.branchcache, 'write')
       
   890     branchcacheread.set(lambda repo: None)
       
   891     branchcachewrite.set(lambda bc, repo: None)
   889     try:
   892     try:
   890         branchmap.read = lambda repo: None
       
   891         branchmap.write = lambda repo: None
       
   892         for name in allfilters:
   893         for name in allfilters:
   893             timer(getbranchmap(name), title=str(name))
   894             timer(getbranchmap(name), title=str(name))
   894     finally:
   895     finally:
   895         branchmap.read = oldread
   896         branchcacheread.restore()
   896         branchmap.branchcache.write = oldwrite
   897         branchcachewrite.restore()
   897     fm.end()
   898     fm.end()
   898 
   899 
   899 @command('perfloadmarkers')
   900 @command('perfloadmarkers')
   900 def perfloadmarkers(ui, repo):
   901 def perfloadmarkers(ui, repo):
   901     """benchmark the time to parse the on-disk markers for a repo
   902     """benchmark the time to parse the on-disk markers for a repo