components/python/python26/patches/Python26-26-pybench.patch
author Shawn Walker <shawn.walker@oracle.com>
Tue, 20 Dec 2011 17:19:09 -0800
changeset 634 bd9c94f9f6e0
permissions -rw-r--r--
6771457 explore compiler performance improvements for python
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
634
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     1
This updates pybench for Python 2.6 with the fixes found in Python 2.7's
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     2
version.
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     3
--- Python-2.6.4/Tools/pybench/pybench.py.orig	Wed Nov  2 17:09:28 2011
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     4
+++ Python-2.6.4/Tools/pybench/pybench.py	Sat Jun 11 08:46:28 2011
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     5
@@ -1,4 +1,4 @@
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     6
-#!/usr/bin/python2.6
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     7
+#!/usr/local/bin/python -O
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     8
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     9
 """ A Python Benchmark Suite
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    10
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    11
@@ -230,7 +230,7 @@
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    12
                 raise ValueError('at least one calibration run is required')
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    13
             self.calibration_runs = calibration_runs
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    14
         if timer is not None:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    15
-            timer = timer
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    16
+            self.timer = timer
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    17
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    18
         # Init variables
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    19
         self.times = []
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    20
@@ -278,7 +278,7 @@
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    21
             for i in calibration_loops:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    22
                 pass
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    23
             t = timer() - t
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    24
-            prep_times.append(t)
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    25
+            prep_times.append(t / CALIBRATION_LOOPS)
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    26
         min_prep_time = min(prep_times)
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    27
         if _debug:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    28
             print
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    29
@@ -689,7 +689,7 @@
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    30
                 other_total_avg_time = other_total_avg_time + other_avg_time
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    31
                 if (benchmarks_compatible and
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    32
                     test.compatible(other)):
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    33
-                    # Both benchmark and tests are comparible
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    34
+                    # Both benchmark and tests are comparable
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    35
                     min_diff = ((min_time * self.warp) /
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    36
                                 (other_min_time * other.warp) - 1.0)
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    37
                     avg_diff = ((avg_time * self.warp) /
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    38
@@ -703,7 +703,7 @@
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    39
                     else:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    40
                         avg_diff = '%+5.1f%%' % (avg_diff * PERCENT)
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    41
                 else:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    42
-                    # Benchmark or tests are not comparible
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    43
+                    # Benchmark or tests are not comparable
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    44
                     min_diff, avg_diff = 'n/a', 'n/a'
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    45
                     tests_compatible = 0
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    46
             print '%30s: %5.0fms %5.0fms %7s %5.0fms %5.0fms %7s' % \