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