[pypy-svn] r67514 - in pypy/build/benchmark: backend server specific specific/test

fijal at codespeak.net fijal at codespeak.net
Sat Sep 5 13:06:43 CEST 2009


Author: fijal
Date: Sat Sep  5 13:06:43 2009
New Revision: 67514

Added:
   pypy/build/benchmark/backend/
   pypy/build/benchmark/server/
   pypy/build/benchmark/specific/runsympy.py   (contents, props changed)
Modified:
   pypy/build/benchmark/specific/test/test_benchmarks.py
Log:
Add a sympy benchmark


Added: pypy/build/benchmark/specific/runsympy.py
==============================================================================
--- (empty file)
+++ pypy/build/benchmark/specific/runsympy.py	Sat Sep  5 13:06:43 2009
@@ -0,0 +1,21 @@
+
+from benchmark.runner import ScriptRunner
+import inspect, sys
+
+def run_sympy():
+    import sympy, time
+    i = sympy.Integer(10000)
+    t0 = time.clock()
+    while i > 0:
+        i -= 1
+    tk = time.clock()
+    print tk - t0
+
+class SympyRunner(ScriptRunner):
+    def __init__(self, executable=sys.executable):
+        ScriptRunner.__init__(self, 'sympybench',
+                              inspect.getsource(run_sympy) + '\nrun_sympy()',
+                              executable=executable)
+
+    def read_output(self, output):
+        return float(output.strip("\n"))

Modified: pypy/build/benchmark/specific/test/test_benchmarks.py
==============================================================================
--- pypy/build/benchmark/specific/test/test_benchmarks.py	(original)
+++ pypy/build/benchmark/specific/test/test_benchmarks.py	Sat Sep  5 13:06:43 2009
@@ -1,6 +1,8 @@
 
+import py
 from benchmark.specific.pystone import PystoneRunner
 from benchmark.specific.richards import RichardsRunner
+from benchmark.specific.runsympy import SympyRunner
 
 def test_pystone():
     runner = PystoneRunner()
@@ -13,3 +15,13 @@
     times = runner.run(1)
     assert len(times) == 1
     assert isinstance(times[0], float)
+
+def test_sympy():
+    try:
+        import sympy
+    except ImportError:
+        py.test.skip("sympy not found")
+    runner = SympyRunner()
+    times = runner.run(1)
+    assert len(times) == 1
+    assert isinstance(times[0], float)



More information about the Pypy-commit mailing list