comparison contrib/perf.py @ 18877:2e9fe9e2671f

perf: add a command to test copies.pathcopies perf An upcoming patch will improve the performance of this function, and this command will be used to demonstrate that improvement.
author Siddharth Agarwal <sid0@fb.com>
date Thu, 04 Apr 2013 20:36:46 -0700
parents a2d4ab4f575d
children e0aa6fff8f02
comparison
equal deleted inserted replaced
18872:16b34391819d 18877:2e9fe9e2671f
1 # perf.py - performance test routines 1 # perf.py - performance test routines
2 '''helper extension to measure performance''' 2 '''helper extension to measure performance'''
3 3
4 from mercurial import cmdutil, scmutil, util, match, commands, obsolete 4 from mercurial import cmdutil, scmutil, util, match, commands, obsolete
5 from mercurial import repoview, branchmap, merge 5 from mercurial import repoview, branchmap, merge, copies
6 import time, os, sys 6 import time, os, sys
7 7
8 cmdtable = {} 8 cmdtable = {}
9 command = cmdutil.command(cmdtable) 9 command = cmdutil.command(cmdtable)
10 10
154 def d(): 154 def d():
155 # acceptremote is True because we don't want prompts in the middle of 155 # acceptremote is True because we don't want prompts in the middle of
156 # our benchmark 156 # our benchmark
157 merge.calculateupdates(repo, wctx, rctx, ancestor, False, False, False, 157 merge.calculateupdates(repo, wctx, rctx, ancestor, False, False, False,
158 acceptremote=True) 158 acceptremote=True)
159 timer(d)
160
161 @command('perfpathcopies', [], "REV REV")
162 def perfpathcopies(ui, repo, rev1, rev2):
163 ctx1 = scmutil.revsingle(repo, rev1, rev1)
164 ctx2 = scmutil.revsingle(repo, rev2, rev2)
165 def d():
166 copies.pathcopies(ctx1, ctx2)
159 timer(d) 167 timer(d)
160 168
161 @command('perfmanifest') 169 @command('perfmanifest')
162 def perfmanifest(ui, repo): 170 def perfmanifest(ui, repo):
163 def d(): 171 def d():