Mercurial > hg
comparison contrib/perf.py @ 18817:c760acc6f69d
perf: add a command to measure merge.calculateupdates perf
The performance of merge.manifestmerge will be improved in upcoming patches.
This command will be used to demonstrate the improvement.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sun, 24 Mar 2013 17:06:10 -0700 |
parents | 3e92772d5383 |
children | 70000d0c44f5 |
comparison
equal
deleted
inserted
replaced
18816:7f7d5f8a8f15 | 18817:c760acc6f69d |
---|---|
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(): |