Patchwork [8,of,8] revsetbenchmark: support for running on other repo

login
register
mail settings
Submitter Pierre-Yves David
Date May 2, 2014, 1:45 a.m.
Message ID <f12936b584c31671efdc.1398995129@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4481/
State Superseded
Commit ea3d75ebea6dba458f6f10b6e713e06f7bbc251b
Headers show

Comments

Pierre-Yves David - May 2, 2014, 1:45 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1398805952 25200
#      Tue Apr 29 14:12:32 2014 -0700
# Node ID f12936b584c31671efdc7fe6009408533b922143
# Parent  cf39f49b464e8d1b28cc934ef43c3f305d1fd2be
revsetbenchmark: support for running on other repo

We add a -R/--repo option to run the benchmarks on another repository. This is
very useful as some repository are bigger/more interesting  than the mercurial one.
Augie Fackler - May 13, 2014, 1:09 a.m.
On Thu, May 01, 2014 at 06:45:29PM -0700, pierre-yves.david@ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1398805952 25200
> #      Tue Apr 29 14:12:32 2014 -0700
> # Node ID f12936b584c31671efdc7fe6009408533b922143
> # Parent  cf39f49b464e8d1b28cc934ef43c3f305d1fd2be
> revsetbenchmark: support for running on other repo

Looks reasonable. I'm queueing everything but 7 and 4 (4 because I
can't figure out some of the commit message, and 7 because I'm not
sure how I feel about it at the moment (feels oddly magical).

>
> We add a -R/--repo option to run the benchmarks on another repository. This is
> very useful as some repository are bigger/more interesting  than the mercurial one.
>
> diff --git a/contrib/revsetbenchmarks.py b/contrib/revsetbenchmarks.py
> --- a/contrib/revsetbenchmarks.py
> +++ b/contrib/revsetbenchmarks.py
> @@ -36,20 +36,23 @@ def update(rev):
>          check_call(['hg', 'update', '--quiet', '--check', str(rev)])
>      except CalledProcessError, exc:
>          print >> sys.stderr, 'update to revision %s failed, aborting' % rev
>          sys.exit(exc.returncode)
>
> -def perf(revset):
> +def perf(revset, target=None):
>      """run benchmark for this very revset"""
>      try:
> -        output = check_output(['./hg',
> -                               '--config',
> -                               'extensions.perf='
> -                               + os.path.join(contribdir, 'perf.py'),
> -                               'perfrevset',
> -                               revset],
> -                               stderr=STDOUT)
> +        cmd = ['./hg',
> +               '--config',
> +               'extensions.perf='
> +               + os.path.join(contribdir, 'perf.py'),
> +               'perfrevset',
> +               revset]
> +        if target is not None:
> +            cmd.append('-R')
> +            cmd.append(target)
> +        output = check_output(cmd, stderr=STDOUT)
>          output = output.lstrip('!') # remove useless ! in this context
>          return output.strip()
>      except CalledProcessError, exc:
>          print >> sys.stderr, 'abort: cannot run revset benchmark'
>          sys.exit(exc.returncode)
> @@ -72,10 +75,12 @@ def getrevs(spec):
>
>
>  parser = OptionParser(usage="usage: %prog [options] <revs>")
>  parser.add_option("-f", "--file",
>                    help="read revset from FILE", metavar="FILE")
> +parser.add_option("-R", "--repo",
> +                  help="run benchmark on REPO", metavar="REPO")
>
>  (options, args) = parser.parse_args()
>
>  if len(sys.argv) < 2:
>      parser.print_help()
> @@ -110,11 +115,11 @@ for r in revs:
>      print "----------------------------"
>      update(r)
>      res = []
>      results.append(res)
>      for idx, rset in enumerate(revsets):
> -        data = perf(rset)
> +        data = perf(rset, target=options.repo)
>          res.append(data)
>          print "%i)" % idx, data
>          sys.stdout.flush()
>      print "----------------------------"
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Augie Fackler - May 13, 2014, 1:11 a.m.
On Thu, May 01, 2014 at 06:45:29PM -0700, pierre-yves.david@ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1398805952 25200
> #      Tue Apr 29 14:12:32 2014 -0700
> # Node ID f12936b584c31671efdc7fe6009408533b922143
> # Parent  cf39f49b464e8d1b28cc934ef43c3f305d1fd2be
> revsetbenchmark: support for running on other repo

got patch application errors (probably from dropping 7), will drop
this one for now too until a resend ensues.

>
> We add a -R/--repo option to run the benchmarks on another repository. This is
> very useful as some repository are bigger/more interesting  than the mercurial one.
>
> diff --git a/contrib/revsetbenchmarks.py b/contrib/revsetbenchmarks.py
> --- a/contrib/revsetbenchmarks.py
> +++ b/contrib/revsetbenchmarks.py
> @@ -36,20 +36,23 @@ def update(rev):
>          check_call(['hg', 'update', '--quiet', '--check', str(rev)])
>      except CalledProcessError, exc:
>          print >> sys.stderr, 'update to revision %s failed, aborting' % rev
>          sys.exit(exc.returncode)
>
> -def perf(revset):
> +def perf(revset, target=None):
>      """run benchmark for this very revset"""
>      try:
> -        output = check_output(['./hg',
> -                               '--config',
> -                               'extensions.perf='
> -                               + os.path.join(contribdir, 'perf.py'),
> -                               'perfrevset',
> -                               revset],
> -                               stderr=STDOUT)
> +        cmd = ['./hg',
> +               '--config',
> +               'extensions.perf='
> +               + os.path.join(contribdir, 'perf.py'),
> +               'perfrevset',
> +               revset]
> +        if target is not None:
> +            cmd.append('-R')
> +            cmd.append(target)
> +        output = check_output(cmd, stderr=STDOUT)
>          output = output.lstrip('!') # remove useless ! in this context
>          return output.strip()
>      except CalledProcessError, exc:
>          print >> sys.stderr, 'abort: cannot run revset benchmark'
>          sys.exit(exc.returncode)
> @@ -72,10 +75,12 @@ def getrevs(spec):
>
>
>  parser = OptionParser(usage="usage: %prog [options] <revs>")
>  parser.add_option("-f", "--file",
>                    help="read revset from FILE", metavar="FILE")
> +parser.add_option("-R", "--repo",
> +                  help="run benchmark on REPO", metavar="REPO")
>
>  (options, args) = parser.parse_args()
>
>  if len(sys.argv) < 2:
>      parser.print_help()
> @@ -110,11 +115,11 @@ for r in revs:
>      print "----------------------------"
>      update(r)
>      res = []
>      results.append(res)
>      for idx, rset in enumerate(revsets):
> -        data = perf(rset)
> +        data = perf(rset, target=options.repo)
>          res.append(data)
>          print "%i)" % idx, data
>          sys.stdout.flush()
>      print "----------------------------"
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Pierre-Yves David - May 13, 2014, 8:28 a.m.
On 05/12/2014 06:09 PM, Augie Fackler wrote:
> On Thu, May 01, 2014 at 06:45:29PM -0700, pierre-yves.david@ens-lyon.org wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>> # Date 1398805952 25200
>> #      Tue Apr 29 14:12:32 2014 -0700
>> # Node ID f12936b584c31671efdc7fe6009408533b922143
>> # Parent  cf39f49b464e8d1b28cc934ef43c3f305d1fd2be
>> revsetbenchmark: support for running on other repo
>
> Looks reasonable. I'm queueing everything but 7 and 4 (4 because I
> can't figure out some of the commit message,

Sound a pretty reasonable reason to postpone the queuing. fixed it.

> and 7 because I'm not
> sure how I feel about it at the moment (feels oddly magical).

For my part, I'm certain the old way is far more awful than the ounce of 
magic is got injected in patch 7. I've updated the description too.

Patch

diff --git a/contrib/revsetbenchmarks.py b/contrib/revsetbenchmarks.py
--- a/contrib/revsetbenchmarks.py
+++ b/contrib/revsetbenchmarks.py
@@ -36,20 +36,23 @@  def update(rev):
         check_call(['hg', 'update', '--quiet', '--check', str(rev)])
     except CalledProcessError, exc:
         print >> sys.stderr, 'update to revision %s failed, aborting' % rev
         sys.exit(exc.returncode)
 
-def perf(revset):
+def perf(revset, target=None):
     """run benchmark for this very revset"""
     try:
-        output = check_output(['./hg',
-                               '--config',
-                               'extensions.perf='
-                               + os.path.join(contribdir, 'perf.py'),
-                               'perfrevset',
-                               revset],
-                               stderr=STDOUT)
+        cmd = ['./hg',
+               '--config',
+               'extensions.perf='
+               + os.path.join(contribdir, 'perf.py'),
+               'perfrevset',
+               revset]
+        if target is not None:
+            cmd.append('-R')
+            cmd.append(target)
+        output = check_output(cmd, stderr=STDOUT)
         output = output.lstrip('!') # remove useless ! in this context
         return output.strip()
     except CalledProcessError, exc:
         print >> sys.stderr, 'abort: cannot run revset benchmark'
         sys.exit(exc.returncode)
@@ -72,10 +75,12 @@  def getrevs(spec):
 
 
 parser = OptionParser(usage="usage: %prog [options] <revs>")
 parser.add_option("-f", "--file",
                   help="read revset from FILE", metavar="FILE")
+parser.add_option("-R", "--repo",
+                  help="run benchmark on REPO", metavar="REPO")
 
 (options, args) = parser.parse_args()
 
 if len(sys.argv) < 2:
     parser.print_help()
@@ -110,11 +115,11 @@  for r in revs:
     print "----------------------------"
     update(r)
     res = []
     results.append(res)
     for idx, rset in enumerate(revsets):
-        data = perf(rset)
+        data = perf(rset, target=options.repo)
         res.append(data)
         print "%i)" % idx, data
         sys.stdout.flush()
     print "----------------------------"