Patchwork [1,of,6] perf: add a command to test addremove performance

login
register
mail settings
Submitter Siddharth Agarwal
Date April 2, 2013, 7:36 p.m.
Message ID <d723353c8a0ab2ced860.1364931392@sid0x220>
Download mbox | patch
Permalink /patch/1243/
State Superseded
Commit a2d4ab4f575d98ef675be7f1f1f34359c58d1e1e
Headers show

Comments

Siddharth Agarwal - April 2, 2013, 7:36 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1364882976 25200
#      Mon Apr 01 23:09:36 2013 -0700
# Node ID d723353c8a0ab2ced8606014abee43aa0b1e3fa4
# Parent  4335ea327027234ef72e2a342fb163be15ce6007
perf: add a command to test addremove performance

Upcoming patches will improve addremove performance. This command will be used
to demonstrate that improvement.
Bryan O'Sullivan - April 2, 2013, 11:04 p.m.
On Tue, Apr 2, 2013 at 12:36 PM, Siddharth Agarwal <sid0@fb.com> wrote:

> perf: add a command to test addremove performance
>

This seems a bit wrong to me. The perf framework mostly tests internal
chunks of code that are difficult to get at from the command line
interface: addremove is not such a chunk of code, and can easily be
measured with "hg --time".
Siddharth Agarwal - April 2, 2013, 11:06 p.m.
On 04/02/2013 04:04 PM, Bryan O'Sullivan wrote:
> This seems a bit wrong to me. The perf framework mostly tests internal 
> chunks of code that are difficult to get at from the command line 
> interface: addremove is not such a chunk of code, and can easily be 
> measured with "hg --time".

Hmm, I thought the main point of perf was to actually do timing 
measurements properly. perfstatus doesn't need to exist either since 
it's easy enough to replicate with hg status -mard.
Matt Mackall - April 3, 2013, 7:48 p.m.
On Tue, 2013-04-02 at 16:06 -0700, Siddharth Agarwal wrote:
> On 04/02/2013 04:04 PM, Bryan O'Sullivan wrote:
> > This seems a bit wrong to me. The perf framework mostly tests internal 
> > chunks of code that are difficult to get at from the command line 
> > interface: addremove is not such a chunk of code, and can easily be 
> > measured with "hg --time".
> 
> Hmm, I thought the main point of perf was to actually do timing 
> measurements properly. perfstatus doesn't need to exist either since 
> it's easy enough to replicate with hg status -mard.

I think this is fine.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -54,6 +54,15 @@  def perfstatus(ui, repo, **opts):
     #                                                False))))
     timer(lambda: sum(map(len, repo.status(**opts))))
 
+@command('perfaddremove')
+def perfaddremove(ui, repo):
+    try:
+        oldquiet = repo.ui.quiet
+        repo.ui.quiet = True
+        timer(lambda: scmutil.addremove(repo, dry_run=True))
+    finally:
+        repo.ui.quiet = oldquiet
+
 def clearcaches(cl):
     # behave somewhat consistently across internal API changes
     if util.safehasattr(cl, 'clearcaches'):