[pypy-svn] r31895 - in pypy/dist/pypy/jit: . codegen codegen/i386/test timeshifter/test

arigo at codespeak.net arigo at codespeak.net
Thu Aug 31 17:50:57 CEST 2006


Author: arigo
Date: Thu Aug 31 17:50:55 2006
New Revision: 31895

Added:
   pypy/dist/pypy/jit/conftest.py
      - copied, changed from r31889, pypy/dist/pypy/jit/codegen/conftest.py
Removed:
   pypy/dist/pypy/jit/codegen/conftest.py
Modified:
   pypy/dist/pypy/jit/codegen/i386/test/test_genc_ts.py
   pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
   pypy/dist/pypy/jit/timeshifter/test/test_tlr.py
Log:
Added --benchmark support in test_timeshift too.  It measures the speed
of the residual graphs compiled by genc.

Mention a problem in test_tlr.


Modified: pypy/dist/pypy/jit/codegen/i386/test/test_genc_ts.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/i386/test/test_genc_ts.py	(original)
+++ pypy/dist/pypy/jit/codegen/i386/test/test_genc_ts.py	Thu Aug 31 17:50:55 2006
@@ -6,7 +6,7 @@
 from pypy.translator.c.genc import CStandaloneBuilder
 from pypy.rpython.unroll import unrolling_iterable
 from pypy.jit.codegen.i386.ri386genop import RI386GenOp
-from pypy.jit.codegen.conftest import Benchmark
+from pypy.jit.conftest import Benchmark
 
 
 class I386TimeshiftingTestMixin(object):
@@ -119,7 +119,7 @@
         if (lines[1].startswith('{') and
             lines[1].endswith('iterations/second}')):
             testname = sys._getframe(1).f_code.co_name
-            os.write(2, '\n{%s: %s' % (testname, lines.pop(1)[1:]))
+            os.write(2, '{%s: %s\n' % (testname, lines.pop(1)[1:]))
         assert len(lines) == 2
         lastline = lines[1]
         if hasattr(ll_function, 'convert_result'):

Modified: pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py	Thu Aug 31 17:50:55 2006
@@ -18,6 +18,7 @@
 from pypy.annotation.policy import AnnotatorPolicy
 from pypy.translator.backendopt.inline import auto_inlining
 from pypy import conftest
+from pypy.jit.conftest import Benchmark
 
 P_NOVIRTUAL = AnnotatorPolicy()
 P_NOVIRTUAL.novirtualcontainer = True
@@ -254,6 +255,21 @@
         res = llinterp.eval_graph(residual_graph, residualargs)
         if hasattr(ll_function, 'convert_result'):
             res = ll_function.convert_result(res)
+
+        # get some benchmarks with genc
+        if Benchmark.ENABLED:
+            from pypy.translator.interactive import Translation
+            import sys
+            testname = sys._getframe(1).f_code.co_name
+            def ll_main():
+                bench = Benchmark(testname)
+                while True:
+                    ll_generated(*residualargs)
+                    if bench.stop():
+                        break
+            t = Translation(ll_main)
+            main = t.compile_c([])
+            main()
         return res
 
     def check_insns(self, expected=None, **counts):

Modified: pypy/dist/pypy/jit/timeshifter/test/test_tlr.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_tlr.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_tlr.py	Thu Aug 31 17:50:55 2006
@@ -21,3 +21,8 @@
         res = self.timeshift(tlr_interpret, [bytecode, 1764], [0],
                              policy=P_OOPSPEC)
         assert res == 3111696
+
+        import py; py.test.skip("XXX the following fails")
+        res = self.timeshift(tlr_interpret, [bytecode, 9], [0, 1],
+                             policy=P_OOPSPEC)
+        assert res == 81



More information about the Pypy-commit mailing list