D2624: perf: teach perfbdiff to call blocks() and to use xdiff
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Wed Mar 7 11:26:50 EST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd382344c69aa: perf: teach perfbdiff to call blocks() and to use xdiff (authored by indygreg, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D2624?vs=6522&id=6691
REVISION DETAIL
https://phab.mercurial-scm.org/D2624
AFFECTED FILES
contrib/perf.py
CHANGE DETAILS
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -939,11 +939,16 @@
timer(d)
fm.end()
-def _bdiffworker(q, ready, done):
+def _bdiffworker(q, blocks, xdiff, ready, done):
while not done.is_set():
pair = q.get()
while pair is not None:
- mdiff.textdiff(*pair)
+ if xdiff:
+ mdiff.bdiff.xdiffblocks(*pair)
+ elif blocks:
+ mdiff.bdiff.blocks(*pair)
+ else:
+ mdiff.textdiff(*pair)
q.task_done()
pair = q.get()
q.task_done() # for the None one
@@ -954,6 +959,8 @@
('', 'count', 1, 'number of revisions to test (when using --startrev)'),
('', 'alldata', False, 'test bdiffs for all associated revisions'),
('', 'threads', 0, 'number of thread to use (disable with 0)'),
+ ('', 'blocks', False, 'test computing diffs into blocks'),
+ ('', 'xdiff', False, 'use xdiff algorithm'),
],
'-c|-m|FILE REV')
@@ -969,14 +976,21 @@
measure bdiffs for all changes related to that changeset (manifest
and filelogs).
"""
+ opts = pycompat.byteskwargs(opts)
+
+ if opts['xdiff'] and not opts['blocks']:
+ raise error.CommandError('perfbdiff', '--xdiff requires --blocks')
+
if opts['alldata']:
opts['changelog'] = True
if opts.get('changelog') or opts.get('manifest'):
file_, rev = None, file_
elif rev is None:
raise error.CommandError('perfbdiff', 'invalid arguments')
+ blocks = opts['blocks']
+ xdiff = opts['xdiff']
textpairs = []
r = cmdutil.openrevlog(repo, 'perfbdiff', file_, opts)
@@ -1007,15 +1021,21 @@
if not withthreads:
def d():
for pair in textpairs:
- mdiff.textdiff(*pair)
+ if xdiff:
+ mdiff.bdiff.xdiffblocks(*pair)
+ elif blocks:
+ mdiff.bdiff.blocks(*pair)
+ else:
+ mdiff.textdiff(*pair)
else:
q = util.queue()
for i in xrange(threads):
q.put(None)
ready = threading.Condition()
done = threading.Event()
for i in xrange(threads):
- threading.Thread(target=_bdiffworker, args=(q, ready, done)).start()
+ threading.Thread(target=_bdiffworker,
+ args=(q, blocks, xdiff, ready, done)).start()
q.join()
def d():
for pair in textpairs:
To: indygreg, #hg-reviewers, quark, durin42
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list