contrib/perf.py
changeset 16309 e0c1b3ef7c36
parent 16266 77d56a5e74a5
child 16386 ccc173d0914e
equal deleted inserted replaced
16308:2695aaf4eb72 16309:e0c1b3ef7c36
   109     timer(d)
   109     timer(d)
   110 
   110 
   111 def perflookup(ui, repo, rev):
   111 def perflookup(ui, repo, rev):
   112     timer(lambda: len(repo.lookup(rev)))
   112     timer(lambda: len(repo.lookup(rev)))
   113 
   113 
       
   114 def perfnodelookup(ui, repo, rev):
       
   115     import mercurial.revlog
       
   116     mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
       
   117     n = repo[rev].node()
       
   118     def d():
       
   119         cl = mercurial.revlog.revlog(repo.sopener, "00changelog.i")
       
   120         cl.rev(n)
       
   121     timer(d)
       
   122 
   114 def perflog(ui, repo, **opts):
   123 def perflog(ui, repo, **opts):
   115     ui.pushbuffer()
   124     ui.pushbuffer()
   116     timer(lambda: commands.log(ui, repo, rev=[], date='', user='',
   125     timer(lambda: commands.log(ui, repo, rev=[], date='', user='',
   117                                copies=opts.get('rename')))
   126                                copies=opts.get('rename')))
   118     ui.popbuffer()
   127     ui.popbuffer()
   151 
   160 
   152     timer(d)
   161     timer(d)
   153 
   162 
   154 cmdtable = {
   163 cmdtable = {
   155     'perflookup': (perflookup, []),
   164     'perflookup': (perflookup, []),
       
   165     'perfnodelookup': (perfnodelookup, []),
   156     'perfparents': (perfparents, []),
   166     'perfparents': (perfparents, []),
   157     'perfstartup': (perfstartup, []),
   167     'perfstartup': (perfstartup, []),
   158     'perfstatus': (perfstatus, []),
   168     'perfstatus': (perfstatus, []),
   159     'perfwalk': (perfwalk, []),
   169     'perfwalk': (perfwalk, []),
   160     'perfmanifest': (perfmanifest, []),
   170     'perfmanifest': (perfmanifest, []),