[pypy-svn] r17801 - pypy/dist/pypy/translator/goal

ericvrp at codespeak.net ericvrp at codespeak.net
Fri Sep 23 23:41:49 CEST 2005


Author: ericvrp
Date: Fri Sep 23 23:41:48 2005
New Revision: 17801

Modified:
   pypy/dist/pypy/translator/goal/bench-cronjob.py
   pypy/dist/pypy/translator/goal/bench-unix.py
   pypy/dist/pypy/translator/goal/translate_pypy_new.py
Log:
Please have a good look at bench-unix.py !
I think we have been optimizing with the wrong numbers in our mind.

There were two bugs in the formula's used:
1. We did not take into account that we run less iterations
   in Richards, causing our numbers to be 10x too optimistic
2. The formula for number of pystones was reversed

The good news is that it looks like PyPy is beating CPython handsdown
with regards to number of Pystones.

The other news is that Richards probably has a bottleneck.

(note: bench-windows.py still uses the incorrect formulas!)


but don't worry:
There always is a change that I am completely wrong!



Modified: pypy/dist/pypy/translator/goal/bench-cronjob.py
==============================================================================
--- pypy/dist/pypy/translator/goal/bench-cronjob.py	(original)
+++ pypy/dist/pypy/translator/goal/bench-cronjob.py	Fri Sep 23 23:41:48 2005
@@ -25,7 +25,7 @@
     basename = homedir + '/projects/pypy-dist/pypy/translator/goal/' + 'pypy-' + backend
     realname = basename + '-' + revision
 
-    os.open(realname, 'wb').write( open(basename).read() )
+    open(realname, 'wb').write( open(basename).read() )
     os.chmod(realname, stat.S_IRWXU)
     os.unlink(basename)
 

Modified: pypy/dist/pypy/translator/goal/bench-unix.py
==============================================================================
--- pypy/dist/pypy/translator/goal/bench-unix.py	(original)
+++ pypy/dist/pypy/translator/goal/bench-unix.py	Fri Sep 23 23:41:48 2005
@@ -1,9 +1,20 @@
 # benchmarks on a unix machine.
 # to be executed in the goal folder,
-# where a couple of pyp-c* files is expected.
+# where a couple of pypy-* files is expected.
 
 import os, sys
 
+current_result = '''
+executable                       richards              pystone
+pypy-c-17758                     416740ms (326.85x)      916ms (  0.03x)
+pypy-c-17797                     394070ms (309.07x)    99999ms (  3.40x)
+pypy-llvm-17758                  343870ms (269.70x)     1131ms (  0.04x)
+pypy-llvm-17792                  277630ms (217.75x)     1418ms (  0.05x)
+pypy-llvm-17797                  274470ms (215.27x)     1434ms (  0.05x)
+pypy-llvm-17799                  999990ms (784.31x)    99999ms (  3.40x)
+python 2.4.2c1                     1275ms (  1.00x)    29411ms (  1.00x)
+'''
+
 PYSTONE_CMD = 'from test import pystone;pystone.main(%s)'
 PYSTONE_PATTERN = 'This machine benchmarks at'
 RICHARDS_CMD = 'from richards import *;Richards.iterations=%d;main()'
@@ -14,28 +25,29 @@
         if line.startswith(pattern):
             break
     else:
-        raise ValueError, 'this is no valid output'
+        print 'warning: this is no valid output'
+        return 99999.0
     return float(line.split()[len(pattern.split())])
 
 def run_cmd(cmd):
     print "running", cmd
     pipe = os.popen(cmd + ' 2>&1')
     result = pipe.read()
-    print "done"
+    #print "done"
     return result
 
 def run_pystone(executable='python', n=0):
     argstr = PYSTONE_CMD % (str(n) and n or '')
     txt = run_cmd('%s -c "%s"' % (executable, argstr))
     res = get_result(txt, PYSTONE_PATTERN)
-    print res
+    #print res
     return res
 
 def run_richards(executable='python', n=10):
     argstr = RICHARDS_CMD % n
     txt = run_cmd('%s -c "%s"' % (executable, argstr))
-    res = get_result(txt, RICHARDS_PATTERN)
-    print res
+    res = get_result(txt, RICHARDS_PATTERN) * 10 / n
+    #print res
     return res
 
 def get_executables():
@@ -43,24 +55,22 @@
     exes.sort()
     return exes
 
-HEADLINE = '''\
-executable                     abs.richards   abs.pystone   rel.richards   rel.pystone'''
-FMT = '''\
-%-30s   '''          +  '%5d ms       %9.3f     ' + '%5.1f          %5.1f'
+HEADLINE = '''executable                       richards              pystone'''
+FMT = '''%-30s   %6dms (%6.2fx)   %6dms (%6.2fx)'''
 
 def main():
-    print 'getting the richards reference'
+    #print 'getting the richards reference'
     ref_rich = run_richards()
-    print 'getting the pystone reference'
+    #print 'getting the pystone reference'
     ref_stone = run_pystone()
     res = []
     for exe in get_executables():
         exename = os.path.splitext(exe)[0].lstrip('./')
-        res.append( (exename, run_richards(exe, 1), run_pystone(exe, 2000)) )
+        res.append( (exename, run_richards(exe, 1), run_pystone(exe)) )
     res.append( ('python %s' % sys.version.split()[0], ref_rich, ref_stone) )
     print HEADLINE
     for exe, rich, stone in res:
-        print FMT % (exe, rich, stone, rich / ref_rich, ref_stone / stone)
+        print FMT % (exe, rich, rich / ref_rich, stone, stone / ref_stone)
 
 if __name__ == '__main__':
     main()

Modified: pypy/dist/pypy/translator/goal/translate_pypy_new.py
==============================================================================
--- pypy/dist/pypy/translator/goal/translate_pypy_new.py	(original)
+++ pypy/dist/pypy/translator/goal/translate_pypy_new.py	Fri Sep 23 23:41:48 2005
@@ -127,9 +127,9 @@
         print 'Specializing...'
         t.specialize(dont_simplify_again=True,
                      crash_on_first_typeerror=not cmd_line_opt.insist)
-    if cmd_line_opt.optimize and cmd_line_opt.backend != 'llvm':
+    if cmd_line_opt.optimize:
         print 'Back-end optimizations...'
-        t.backend_optimizations()
+        t.backend_optimizations(ssa_form=cmd_line_opt.backend != 'llvm')
     if a and 'fork2' in cmd_line_opt.fork:
         from pypy.translator.goal import unixcheckpoint
         unixcheckpoint.restartable_point(auto='run')



More information about the Pypy-commit mailing list