components/python/python26/patches/Python26-26-pybench.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 11 Mar 2013 10:38:09 -0700
branchs11-update
changeset 2520 ceec631e74d1
parent 634 bd9c94f9f6e0
permissions -rw-r--r--
Close of build 10.

This updates pybench for Python 2.6 with the fixes found in Python 2.7's
version.
--- Python-2.6.4/Tools/pybench/pybench.py.orig	Wed Nov  2 17:09:28 2011
+++ Python-2.6.4/Tools/pybench/pybench.py	Sat Jun 11 08:46:28 2011
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!/usr/local/bin/python -O
 
 """ A Python Benchmark Suite
 
@@ -230,7 +230,7 @@
                 raise ValueError('at least one calibration run is required')
             self.calibration_runs = calibration_runs
         if timer is not None:
-            timer = timer
+            self.timer = timer
 
         # Init variables
         self.times = []
@@ -278,7 +278,7 @@
             for i in calibration_loops:
                 pass
             t = timer() - t
-            prep_times.append(t)
+            prep_times.append(t / CALIBRATION_LOOPS)
         min_prep_time = min(prep_times)
         if _debug:
             print
@@ -689,7 +689,7 @@
                 other_total_avg_time = other_total_avg_time + other_avg_time
                 if (benchmarks_compatible and
                     test.compatible(other)):
-                    # Both benchmark and tests are comparible
+                    # Both benchmark and tests are comparable
                     min_diff = ((min_time * self.warp) /
                                 (other_min_time * other.warp) - 1.0)
                     avg_diff = ((avg_time * self.warp) /
@@ -703,7 +703,7 @@
                     else:
                         avg_diff = '%+5.1f%%' % (avg_diff * PERCENT)
                 else:
-                    # Benchmark or tests are not comparible
+                    # Benchmark or tests are not comparable
                     min_diff, avg_diff = 'n/a', 'n/a'
                     tests_compatible = 0
             print '%30s: %5.0fms %5.0fms %7s %5.0fms %5.0fms %7s' % \