contrib/perf.py
changeset 43436 bfc68404cccd
parent 43197 0c4efb6eb4fa
child 43495 daade078f1f0
equal deleted inserted replaced
43435:0371a8c84827 43436:bfc68404cccd
   758     fm.end()
   758     fm.end()
   759 
   759 
   760 
   760 
   761 @command(
   761 @command(
   762     b'perfstatus',
   762     b'perfstatus',
   763     [(b'u', b'unknown', False, b'ask status to look for unknown files')]
   763     [
       
   764         (b'u', b'unknown', False, b'ask status to look for unknown files'),
       
   765         (b'', b'dirstate', False, b'benchmark the internal dirstate call'),
       
   766     ]
   764     + formatteropts,
   767     + formatteropts,
   765 )
   768 )
   766 def perfstatus(ui, repo, **opts):
   769 def perfstatus(ui, repo, **opts):
   767     """benchmark the performance of a single status call
   770     """benchmark the performance of a single status call
   768 
   771 
   774     opts = _byteskwargs(opts)
   777     opts = _byteskwargs(opts)
   775     # m = match.always(repo.root, repo.getcwd())
   778     # m = match.always(repo.root, repo.getcwd())
   776     # timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False,
   779     # timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False,
   777     #                                                False))))
   780     #                                                False))))
   778     timer, fm = gettimer(ui, opts)
   781     timer, fm = gettimer(ui, opts)
   779     timer(lambda: sum(map(len, repo.status(unknown=opts[b'unknown']))))
   782     if opts[b'dirstate']:
       
   783         dirstate = repo.dirstate
       
   784         m = scmutil.matchall(repo)
       
   785         unknown = opts[b'unknown']
       
   786 
       
   787         def status_dirstate():
       
   788             s = dirstate.status(
       
   789                 m, subrepos=[], ignored=False, clean=False, unknown=unknown
       
   790             )
       
   791             sum(map(len, s))
       
   792 
       
   793         timer(status_dirstate)
       
   794     else:
       
   795         timer(lambda: sum(map(len, repo.status(unknown=opts[b'unknown']))))
   780     fm.end()
   796     fm.end()
   781 
   797 
   782 
   798 
   783 @command(b'perfaddremove', formatteropts)
   799 @command(b'perfaddremove', formatteropts)
   784 def perfaddremove(ui, repo, **opts):
   800 def perfaddremove(ui, repo, **opts):