[pypy-svn] r74743 - pypy/trunk/pypy/translator/goal
agaynor at codespeak.net
agaynor at codespeak.net
Tue May 25 19:39:21 CEST 2010
Author: agaynor
Date: Tue May 25 19:39:19 2010
New Revision: 74743
Added:
pypy/trunk/pypy/translator/goal/targetosreadbench.py
Log:
Added target for os.read benchmarking
Added: pypy/trunk/pypy/translator/goal/targetosreadbench.py
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/translator/goal/targetosreadbench.py Tue May 25 19:39:19 2010
@@ -0,0 +1,25 @@
+"""
+A benchmark for read()
+"""
+
+import os
+
+# __________ Entry point __________
+
+def entry_point(argv):
+ length = 0
+ if len(argv) > 1:
+ length = int(argv[1])
+ else:
+ length = 100
+ for i in xrange(100000):
+ f = os.open(__file__, 0666, os.O_RDONLY)
+ os.read(f, length)
+ os.close(f)
+ return 0
+
+# _____ Define and setup target ___
+
+def target(*args):
+ return entry_point, None
+
More information about the Pypy-commit
mailing list