[pypy-dev] benchunix.py fixes

pypy at pocketnix.org pypy at pocketnix.org
Mon Apr 11 14:17:39 CEST 2011


Hi

bench-unix.py did not work so i did q quick repair job and enhancement 
on a small bit of the code, included as 3 patches below. i seem to 
recall someone mentioning that this was depreciated however as a new 
user it was tempting to use it as it was the first thing i saw and is 
a nice quick test for getting a rough guide of the relative 
performance of several versions of pypy i have generated

currently contemplating a rewrite of the code so let me know if there 
is something better or if someone else is working on something

----------------------------------------------------
Add newer python implementations and benchmark system default interpreter

--- a/pypy/translator/goal/bench-unix.py
+++ b/pypy/translator/goal/bench-unix.py
@@ -102,7 +102,7 @@
     ref_rich, ref_stone = None, None
 
 #    for exe in '/usr/local/bin/python2.5 python2.4 python2.3'.split():
-    for exe in 'python2.4 python2.3'.split():
+    for exe in 'python2.7 python2.6 python2.4 python2.3 python'.split():
         v = os.popen(exe + ' -c "import sys;print sys.version.split()[0]"').rea
         if not v:
             continue

------------------------------------------------------------------------------
Discard missing interpreters

--- a/pypy/translator/goal/bench-unix.py
+++ b/pypy/translator/goal/bench-unix.py
@@ -102,7 +102,13 @@
     ref_rich, ref_stone = None, None
 
 #    for exe in '/usr/local/bin/python2.5 python2.4 python2.3'.split():
-    for exe in 'python2.4 python2.3'.split():
+    for exe in 'python2.7 python2.6 python2.4 python2.3 python'.split():
+        path = os.environ.get("PATH", "")
+        path = [x + os.sep + exe for x in path.split(os.pathsep) if exe in os.l
+        if len(path) > 0:
+            exe = path[0]
+        else:
+            continue
         v = os.popen(exe + ' -c "import sys;print sys.version.split()[0]"').rea
         if not v:
             continue

------------------------------------------------------------------------------
Fix off by one

--- a/pypy/translator/goal/bench-unix.py
+++ b/pypy/translator/goal/bench-unix.py
@@ -85,7 +85,7 @@
         if os.path.isdir(exe) or exe.endswith('.jar'):
             continue
         try:
-            exes.append( (exe.split('-')[2], exe) )
+            exes.append( (exe.split('-')[1], exe) )
         except:
             pass    #skip filenames without version number
     exes.sort()

------------------------------------------------------------------------------



More information about the Pypy-dev mailing list