[pypy-svn] r12200 - in pypy/dist: goal pypy/translator/test

tismer at codespeak.net tismer at codespeak.net
Wed May 11 21:13:05 CEST 2005


Author: tismer
Date: Wed May 11 21:13:05 2005
New Revision: 12200

Added:
   pypy/dist/goal/targetrpystone2.py   (contents, props changed)
Modified:
   pypy/dist/goal/targetrpystone.py
   pypy/dist/pypy/translator/test/rpystone.py
Log:
did a few changes to enable switching off those rpystone tests
which are expensive at the moment.
Changed the test to run bot CPython and the compiled version.
Added a targetrpystone2.py file which is configured for
the fast version.
Feel free toplay with the options in rpystone.setslow()

With the current settings, the speed gain is about 10-12

Modified: pypy/dist/goal/targetrpystone.py
==============================================================================
--- pypy/dist/goal/targetrpystone.py	(original)
+++ pypy/dist/goal/targetrpystone.py	Wed May 11 21:13:05 2005
@@ -6,17 +6,15 @@
 
 LOOPS = 150000
 
+# rpystone.setslow(False)
+
 def entry_point():
     rpystone.entrypoint(LOOPS)
     
 # _____ Define and setup target _____
 def target():
     global space, mmentrypoints
-    # disable translation of the whole of classobjinterp.py
-    #StdObjSpace.setup_old_style_classes = lambda self: None
     space = StdObjSpace()
-    # call cache filling code
-    #buildcache2.buildcache(space)
 
     # ------------------------------------------------------------
 
@@ -27,9 +25,12 @@
 def run(c_entry_point):
     res_w = c_entry_point()
     print res_w
+    print "CPython:"
+    rpystone.entrypoint(50000)
 
 if __name__ == "__main__":
     # just run it without translation
+    LOOPS = 50000
     target()
     run(entry_point)
     
\ No newline at end of file

Added: pypy/dist/goal/targetrpystone2.py
==============================================================================
--- (empty file)
+++ pypy/dist/goal/targetrpystone2.py	Wed May 11 21:13:05 2005
@@ -0,0 +1,36 @@
+import buildcache2
+from pypy.objspace.std.objspace import StdObjSpace
+from pypy.translator.test import rpystone
+
+# __________  Entry point  __________
+
+LOOPS = 1000000
+
+rpystone.setslow(False)
+
+def entry_point():
+    rpystone.entrypoint(LOOPS)
+    
+# _____ Define and setup target _____
+def target():
+    global space, mmentrypoints
+    space = StdObjSpace()
+
+    # ------------------------------------------------------------
+
+    return entry_point, []
+
+# _____ Run translated _____
+
+def run(c_entry_point):
+    res_w = c_entry_point()
+    print res_w
+    print "CPython:"
+    rpystone.entrypoint(50000)
+
+if __name__ == "__main__":
+    # just run it without translation
+    LOOPS = 50000
+    target()
+    run(entry_point)
+    
\ No newline at end of file

Modified: pypy/dist/pypy/translator/test/rpystone.py
==============================================================================
--- pypy/dist/pypy/translator/test/rpystone.py	(original)
+++ pypy/dist/pypy/translator/test/rpystone.py	Wed May 11 21:13:05 2005
@@ -1,5 +1,21 @@
 #! /usr/bin/env python
 
+def setslow(X):
+    global XF1, XF2, XF3, XP1, XP2, XP3, XP4, XP5, XP6, XP7, XP8
+    XF1 = True
+    XF2 = X
+    XF3 = True
+    XP1 = X
+    XP2 = X
+    XP3 = True
+    XP4 = X
+    XP5 = True
+    XP6 = True
+    XP7 = True
+    XP8 = X
+
+setslow(True)
+
 """
 "PYSTONE" Benchmark Program
 
@@ -115,28 +131,28 @@
     starttime = clock()
 
     for i in range(loops):
-        Proc5()
-        Proc4()
+        if XP5:Proc5()
+        if XP4:Proc4()
         IntLoc1 = 2
         IntLoc2 = 3
         String2Loc = "DHRYSTONE PROGRAM, 2'ND STRING"
         EnumLoc = Ident2
-        g.BoolGlob = not Func2(String1Loc, String2Loc)
+        if XF2:g.BoolGlob = not Func2(String1Loc, String2Loc)
         while IntLoc1 < IntLoc2:
             IntLoc3 = 5 * IntLoc1 - IntLoc2
             IntLoc3 = Proc7(IntLoc1, IntLoc2)
             IntLoc1 = IntLoc1 + 1
-        Proc8(g.Array1Glob, g.Array2Glob, IntLoc1, IntLoc3)
-        g.PtrGlb = Proc1(g.PtrGlb)
+        if XP8:Proc8(g.Array1Glob, g.Array2Glob, IntLoc1, IntLoc3)
+        if XP1:g.PtrGlb = Proc1(g.PtrGlb)
         CharIndex = 'A'
         while CharIndex <= g.Char2Glob:
-            if EnumLoc == Func1(CharIndex, 'C'):
-                EnumLoc = Proc6(Ident1)
+            if XF1 and EnumLoc == Func1(CharIndex, 'C'):
+                if XP6:EnumLoc = Proc6(Ident1)
             CharIndex = chr(ord(CharIndex)+1)
         IntLoc3 = IntLoc2 * IntLoc1
         IntLoc2 = IntLoc3 / IntLoc1
         IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1
-        IntLoc1 = Proc2(IntLoc1)
+        if XP2:IntLoc1 = Proc2(IntLoc1)
 
     benchtime = clock() - starttime - nulltime
     return benchtime, (loops / benchtime)
@@ -146,12 +162,12 @@
     PtrParIn.IntComp = 5
     NextRecord.IntComp = PtrParIn.IntComp
     NextRecord.PtrComp = PtrParIn.PtrComp
-    NextRecord.PtrComp = Proc3(NextRecord.PtrComp)
+    if XP3:NextRecord.PtrComp = Proc3(NextRecord.PtrComp)
     if NextRecord.Discr == Ident1:
         NextRecord.IntComp = 6
-        NextRecord.EnumComp = Proc6(PtrParIn.EnumComp)
+        if XP6:NextRecord.EnumComp = Proc6(PtrParIn.EnumComp)
         NextRecord.PtrComp = g.PtrGlb.PtrComp
-        NextRecord.IntComp = Proc7(NextRecord.IntComp, 10)
+        if XP7:NextRecord.IntComp = Proc7(NextRecord.IntComp, 10)
     else:
         PtrParIn = NextRecord.copy()
     NextRecord.PtrComp = None
@@ -176,7 +192,7 @@
         PtrParOut = g.PtrGlb.PtrComp
     else:
         g.IntGlob = 100
-    g.PtrGlb.IntComp = Proc7(10, g.IntGlob)
+    if XP7:g.PtrGlb.IntComp = Proc7(10, g.IntGlob)
     return PtrParOut
 
 def Proc4():
@@ -195,7 +211,7 @@
 
 def Proc6(EnumParIn):
     EnumParOut = EnumParIn
-    if not Func3(EnumParIn):
+    if XF3 and not Func3(EnumParIn):
         EnumParOut = Ident4
     if EnumParIn == Ident1:
         EnumParOut = Ident1
@@ -241,7 +257,7 @@
 def Func2(StrParI1, StrParI2):
     IntLoc = 1
     while IntLoc <= 1:
-        if Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1:
+        if XF1 and Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1:
             CharLoc = 'A'
             IntLoc = IntLoc + 1
     if CharLoc >= 'W' and CharLoc <= 'Z':



More information about the Pypy-commit mailing list