On OS X, running with my latest changes to mercurial (all merged I believe), against pypy repo, @9573c6ca1519 The bench_sub.py: import sys, time, os from mercurial import dispatch l = [] for i in range(int(sys.argv[1])): t0 = time.time() dispatch.dispatch(dispatch.request(sys.argv[2:])) l.append(time.time() - t0) print >>sys.stderr, l bench.py: import os, sys import json, time from subprocess import Popen, PIPE, STDOUT def sanitize(cmd): if isinstance(cmd, File): return "file%d" % cmd.no return cmd class Command(object): def __init__(self, cmd, no, cleanup=None): self.cmd = cmd self.no = no self.cleanup = cleanup def repr(self): return " ".join([sanitize(x) for x in self.cmd]) pypy_files = [ 'rpython/jit/metainterp/pyjitpl.py', ] mercurial_files = [ 'mercurial/manifest.py', ] class File(object): def __init__(self, no): self.no = no commands = [ Command(['log'], 6), Command(['log', '-p', File(0)], 6), Command(['bundle', '-t', 'none', '-a', "'*'"], 1), Command(['bundle', '-t', 'gzip', '-a', "'*'"], 1), # unbundle, tested separately Command(['blame', File(0)], 20), Command(['diff'], 1000), # Command(['hg', 'up', 'null'], 10, ['hg', 'up', 'tip']) <- disabled, not CPU bound # http server, tested separately Command(['status'], 1000), # mostly listdir # rebase # amend # commit ] print "Using following benchmarks:" bench_sub = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'bench_sub.py') def run_benchmark(cmd, files): cmd_run = [] for item in cmd.cmd: if isinstance(item, File): cmd_run.append(files[item.no]) else: cmd_run.append(item) print "Running: " + " ".join(cmd_run) args = ['python', bench_sub, str(cmd.no)] + cmd_run p = Popen(args, stdout=PIPE, stderr=PIPE) stdout, stderr = p.communicate() if p.returncode != 0: print >>sys.stderr, "Output:\n" + stdout print >>sys.stderr, "Error:\n" + stderr raise Exception("returned " + str(p.returncode)) else: d = {} exec("l = " + stderr) in d return d['l'] if __name__ == '__main__': result = [] for cmd in commands: result.append((cmd, run_benchmark(cmd, pypy_files))) open("result%d.json" % int(time.time()), "w").write(json.dumps({'version': 0.2, 'result': [(cmd.repr(), res) for cmd, res in result], 'executable': sys.executable})) print "Results:" print "Total: Warmed up:" for cmd, res in result: one_third = len(res) // 3 r2 = res[one_third:] print "%.2fs %.2fs - %s" % (sum(res)/len(res), sum(r2)/len(r2), cmd.repr()) """ * hg log * hg log -p * hg bundle -t gzip -a - the main component of server side clone * hg unbundle - the main component of client side clone * hg blame * updating - hg up null followed by hg up tip * performance of http server (hg serve) * hg commit * hg amend * hg rebase * hg status """ CPython: Total: Warmed up: 13.31s 13.28s - log 8.17s 8.16s - log -p file0 46.34s 46.34s - bundle -t none -a '*' 102.15s 102.15s - bundle -t gzip -a '*' 2.45s 2.42s - blame file0 0.03s 0.03s - diff 0.04s 0.04s - status PyPy before my commits: Total: Warmed up: 3.37s 3.17s - log 23.59s 23.28s - log -p file0 52.40s 52.40s - bundle -t none -a '*' 113.61s 113.61s - bundle -t gzip -a '*' 5.56s 5.48s - blame file0 0.11s 0.11s - diff 0.14s 0.14s - status PyPy now: Total: Warmed up: 3.76s 3.43s - log 10.18s 9.96s - log -p file0 58.33s 58.33s - bundle -t none -a '*' 93.77s 93.77s - bundle -t gzip -a '*' 2.33s 2.27s - blame file0 0.04s 0.04s - diff 0.05s 0.05s - status