equal
deleted
inserted
replaced
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 |
5 from mercurial import repoview, branchmap, merge |
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 |
120 ds = repo.dirstate |
120 ds = repo.dirstate |
121 "a" in ds |
121 "a" in ds |
122 def d(): |
122 def d(): |
123 ds._dirty = True |
123 ds._dirty = True |
124 ds.write() |
124 ds.write() |
|
125 timer(d) |
|
126 |
|
127 @command('perfmergecalculate', |
|
128 [('r', 'rev', '.', 'rev to merge against')]) |
|
129 def perfmergecalculate(ui, repo, rev): |
|
130 wctx = repo[None] |
|
131 rctx = scmutil.revsingle(repo, rev, rev) |
|
132 ancestor = wctx.ancestor(rctx) |
|
133 # we don't want working dir files to be stat'd in the benchmark, so prime |
|
134 # that cache |
|
135 wctx.dirty() |
|
136 def d(): |
|
137 # acceptremote is True because we don't want prompts in the middle of |
|
138 # our benchmark |
|
139 merge.calculateupdates(repo, wctx, rctx, ancestor, False, False, False, |
|
140 acceptremote=True) |
125 timer(d) |
141 timer(d) |
126 |
142 |
127 @command('perfmanifest') |
143 @command('perfmanifest') |
128 def perfmanifest(ui, repo): |
144 def perfmanifest(ui, repo): |
129 def d(): |
145 def d(): |