comparison contrib/perf.py @ 20178:74aea4be8e78

perf: add perfmoonwalk command to walk the changelog backwards This lets us test the effectiveness (or ineffectiveness) of the revlog chunk cache when walking revlogs backwards.
author Brodie Rao <brodie@sf.io>
date Sun, 17 Nov 2013 18:04:28 -0500
parents 175c6fd8cacc
children d67a7758da6d
comparison
equal deleted inserted replaced
20177:c5f0574034ef 20178:74aea4be8e78
240 def perflog(ui, repo, **opts): 240 def perflog(ui, repo, **opts):
241 ui.pushbuffer() 241 ui.pushbuffer()
242 timer(lambda: commands.log(ui, repo, rev=[], date='', user='', 242 timer(lambda: commands.log(ui, repo, rev=[], date='', user='',
243 copies=opts.get('rename'))) 243 copies=opts.get('rename')))
244 ui.popbuffer() 244 ui.popbuffer()
245
246 @command('perfmoonwalk')
247 def perfmoonwalk(ui, repo):
248 """benchmark walking the changelog backwards
249
250 This also loads the changelog data for each revision in the changelog.
251 """
252 def moonwalk():
253 for i in xrange(len(repo), -1, -1):
254 ctx = repo[i]
255 ctx.branch() # read changelog data (in addition to the index)
256 timer(moonwalk)
245 257
246 @command('perftemplating') 258 @command('perftemplating')
247 def perftemplating(ui, repo): 259 def perftemplating(ui, repo):
248 ui.pushbuffer() 260 ui.pushbuffer()
249 timer(lambda: commands.log(ui, repo, rev=[], date='', user='', 261 timer(lambda: commands.log(ui, repo, rev=[], date='', user='',