[pypy-svn] r59739 - pypy/build/benchmem
xoraxax at codespeak.net
xoraxax at codespeak.net
Wed Nov 5 20:27:37 CET 2008
Author: xoraxax
Date: Wed Nov 5 20:27:36 2008
New Revision: 59739
Modified:
pypy/build/benchmem/runbench.py
pypy/build/benchmem/tracer.py
Log:
Do two compilation passes in the appprofile runner, make the pauses benchrunner a bit better rawdata wise.
Modified: pypy/build/benchmem/runbench.py
==============================================================================
--- pypy/build/benchmem/runbench.py (original)
+++ pypy/build/benchmem/runbench.py Wed Nov 5 20:27:36 2008
@@ -212,7 +212,18 @@
#self.log("created", benchpyfile)
cmd = "%s -u %s" %(self.executable, benchpyfile)
self.log("running %s(%s)" %(name, self.options.numiter))
- os.system(cmd + " --compileonly")
+
+ # we want to avoid measuring the size impact of
+ # compiler invocation, so we have to manually compile
+ # the modules and hope
+
+ # first compile the dependencies of the module
+ os.system(cmd + " --importonly")
+ # then compile the module itself
+ compile_cmd = 'from py_compile import compile; compile("%s")' % (str(benchpyfile), )
+ compile_cmdline = "%s -c '%s'" % (self.executable, compile_cmd)
+ os.system(compile_cmdline)
+
stdout, stdin = os.popen2(cmd)
pid = int(stdin.readline())
self.write_benchheader(name, self.options.numiter)
@@ -231,7 +242,7 @@
if __name__ == "__main__":
import os, sys, gc
- if len(sys.argv) > 1 and sys.argv[1] == '--compileonly':
+ if len(sys.argv) > 1 and sys.argv[1] == '--importonly':
raise SystemExit
pid = os.getpid()
write(str(pid) + "\\n")
@@ -253,11 +264,15 @@
class BenchRunnerPauses(BenchRunner):
benchtype = 'pauses'
+ # this benchrunner uses a tracing hook
+ # to send characters over a pipe to another process
+ # only wall clock time can be tracked, the process
+ # scheduling can therefore influence the measurements
def __init__(self, *args):
BenchRunner.__init__(self, *args)
self.benchpath = benchmarkdir.join("appprofiles.py")
- self.last_t = time.time()
+ self.last_t = None
# XXX
self.args = (1000, 3)
@@ -269,10 +284,11 @@
self.logstream.flush()
def measure(self):
- t = time.time()
- diff = t - self.last_t
- self.logstream.write(str(diff) + "\n")
- self.last_t = t
+ if self.last_t is not None:
+ t = time.time()
+ diff = t - self.last_t
+ self.logstream.write(str(diff) + "\n")
+ self.last_t = time.time()
def run_once(self, name):
self.write_benchheader(name, self.args)
@@ -570,7 +586,7 @@
elif benchtype == "appprofiles":
return BenchRunnerAppProfiles
elif benchtype == 'pauses':
- xxx
+ return BenchRunnerPauses
else:
raise NotImplementedError("Benchmark type: %s" % (benchtype,))
Modified: pypy/build/benchmem/tracer.py
==============================================================================
--- pypy/build/benchmem/tracer.py (original)
+++ pypy/build/benchmem/tracer.py Wed Nov 5 20:27:36 2008
@@ -19,7 +19,7 @@
sys.path.insert(0, '%s')
from tracer import run_with_tracing
- def write():
+ def write(): # this function should not trigger gc collections
sys.stdout.write('c')
sys.stdout.flush()
sys.stdin.read(1)
More information about the Pypy-commit
mailing list