[pypy-svn] r54323 - pypy/dist/pypy/translator/benchmark
arigo at codespeak.net
arigo at codespeak.net
Fri May 2 15:13:08 CEST 2008
Author: arigo
Date: Fri May 2 15:13:07 2008
New Revision: 54323
Modified:
pypy/dist/pypy/translator/benchmark/bench-custom.py
pypy/dist/pypy/translator/benchmark/result.py
Log:
For very long executable names, this displays the results
more readably by splitting the table in two.
Modified: pypy/dist/pypy/translator/benchmark/bench-custom.py
==============================================================================
--- pypy/dist/pypy/translator/benchmark/bench-custom.py (original)
+++ pypy/dist/pypy/translator/benchmark/bench-custom.py Fri May 2 15:13:07 2008
@@ -5,6 +5,8 @@
from pypy.translator.benchmark.benchmarks import BENCHMARKS
import os, sys, time, pickle, re, py
+SPLIT_TABLE = True # useful when executable names are very long
+
def get_executables(args): #sorted by revision number (highest first)
exes = sorted(args, key=os.path.getmtime)
r = []
@@ -52,17 +54,28 @@
pickle.dump(benchmark_result, open(options.picklefile, 'wb'))
- stats = ['stat:st_mtime', 'exe_name', 'pypy_rev']
+ exe_stats = ['stat:st_mtime', 'exe_name', 'pypy_rev']
+ if not SPLIT_TABLE:
+ stats = exe_stats[:]
+ else:
+ stats = ['exe']
for b in benchmarks:
stats.append('bench:'+b.name)
if options.relto:
relto = options.relto
else:
relto = full_pythons[0]
- for row in benchmark_result.txt_summary(stats,
- relto=relto,
- filteron=lambda r: r.exe_name in exes):
+ kwds = {'relto': relto,
+ 'filteron' :lambda r: r.exe_name in exes,
+ }
+ for row in benchmark_result.txt_summary(stats, **kwds):
print row
+ if SPLIT_TABLE:
+ print
+ print 'Reference:'
+ for row in benchmark_result.txt_summary(['exe'] + exe_stats,
+ **kwds):
+ print row
if __name__ == '__main__':
from optparse import OptionParser
Modified: pypy/dist/pypy/translator/benchmark/result.py
==============================================================================
--- pypy/dist/pypy/translator/benchmark/result.py (original)
+++ pypy/dist/pypy/translator/benchmark/result.py Fri May 2 15:13:07 2008
@@ -68,6 +68,7 @@
return concretetable
class BenchmarkResult(object):
+ IDS = {}
def __init__(self, exe, max_results=10):
self.max_results = max_results
@@ -116,6 +117,10 @@
return_default = True
if hasattr(self, stat):
return getattr(self, stat)
+ if stat == 'exe':
+ myid = len(BenchmarkResult.IDS)
+ myid = BenchmarkResult.IDS.setdefault(self, myid)
+ return '[%s]' % myid
statkind, statdetail = stat.split(':')
if statkind == 'stat':
return getattr(self.exe_stat, statdetail)
More information about the pypy-svn
mailing list