contrib/perf.py
changeset 34342 b3538c03a804
parent 32888 04fa5520d167
child 34343 255c761a52db
equal deleted inserted replaced
34341:01e8ab4b6573 34342:b3538c03a804
   368 # perf commands
   368 # perf commands
   369 
   369 
   370 @command('perfwalk', formatteropts)
   370 @command('perfwalk', formatteropts)
   371 def perfwalk(ui, repo, *pats, **opts):
   371 def perfwalk(ui, repo, *pats, **opts):
   372     timer, fm = gettimer(ui, opts)
   372     timer, fm = gettimer(ui, opts)
   373     try:
   373     m = scmutil.match(repo[None], pats, {})
   374         m = scmutil.match(repo[None], pats, {})
   374     timer(lambda: len(list(repo.dirstate.walk(m, [], True, False))))
   375         timer(lambda: len(list(repo.dirstate.walk(m, [], True, False))))
       
   376     except Exception:
       
   377         try:
       
   378             m = scmutil.match(repo[None], pats, {})
       
   379             timer(lambda: len([b for a, b, c in repo.dirstate.statwalk([], m)]))
       
   380         except Exception:
       
   381             timer(lambda: len(list(cmdutil.walk(repo, pats, {}))))
       
   382     fm.end()
   375     fm.end()
   383 
   376 
   384 @command('perfannotate', formatteropts)
   377 @command('perfannotate', formatteropts)
   385 def perfannotate(ui, repo, f, **opts):
   378 def perfannotate(ui, repo, f, **opts):
   386     timer, fm = gettimer(ui, opts)
   379     timer, fm = gettimer(ui, opts)