Patchwork [1,of,9] perf: add a command to measure merge.calculateupdates perf

login
register
mail settings
Submitter Siddharth Agarwal
Date March 25, 2013, 12:27 a.m.
Message ID <72770effd8ccb4b33430.1364171265@sid0x220>
Download mbox | patch
Permalink /patch/1177/
State Superseded
Commit 4085c9fafb8e6f1b68c8f9d4d549304d948e6e5a
Headers show

Comments

Siddharth Agarwal - March 25, 2013, 12:27 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1364169970 25200
#      Sun Mar 24 17:06:10 2013 -0700
# Node ID 72770effd8ccb4b33430410f5b0bd33964795af5
# Parent  009929458ae8a97e342fe7fbbdbada8798870aa1
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.
Bryan O'Sullivan - March 26, 2013, 12:17 a.m.
On Sun, Mar 24, 2013 at 5:27 PM, Siddharth Agarwal <sid0@fb.com> wrote:

> perf: add a command to measure merge.calculateupdates perf
>

I've applied patches 1 and 6 from this series. Will drop the rest pending a
resend.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -2,7 +2,7 @@ 
 '''helper extension to measure performance'''
 
 from mercurial import cmdutil, scmutil, util, match, commands, obsolete
-from mercurial import repoview, branchmap
+from mercurial import repoview, branchmap, merge
 import time, os, sys
 
 cmdtable = {}
@@ -124,6 +124,22 @@  def perfdirstatewrite(ui, repo):
         ds.write()
     timer(d)
 
+@command('perfmergecalculate',
+         [('r', 'rev', '.', 'rev to merge against')])
+def perfmergecalculate(ui, repo, rev):
+    wctx = repo[None]
+    rctx = scmutil.revsingle(repo, rev, rev)
+    ancestor = wctx.ancestor(rctx)
+    # we don't want working dir files to be stat'd in the benchmark, so prime
+    # that cache
+    wctx.dirty()
+    def d():
+        # acceptremote is True because we don't want prompts in the middle of
+        # our benchmark
+        merge.calculateupdates(repo, wctx, rctx, ancestor, False, False, False,
+                               acceptremote=True)
+    timer(d)
+
 @command('perfmanifest')
 def perfmanifest(ui, repo):
     def d():