feat: add python3 benchmark runner and fix python3 compatibility in benchmark scripts

Add python3 as a new language entry in the benchmark runner configuration, enabling automated performance testing with Python 3. Update multiple benchmark scripts (binary_trees.py, delta_blue.py, fib.py, for.py, method_call.py) to be compatible with Python 3 by adding `from __future__ import print_function`, replacing `xrange` with a `range` polyfill, converting print statements to function calls, and replacing integer division with floor division. Remove the custom `OrderedCollection` class in delta_blue.py in favor of standard Python lists.
This commit is contained in:
Bob Nystrom
2014-02-13 01:22:42 +00:00
parent 05857c8b47
commit c04865df2e
6 changed files with 59 additions and 35 deletions
+9 -1
View File
@@ -1,8 +1,16 @@
from __future__ import print_function
import time
# Map "range" to an efficient range in both Python 2 and 3.
try:
range = xrange
except NameError:
pass
start = time.clock()
list = []
for i in xrange(0, 1000000):
for i in range(0, 1000000):
list.append(i)
sum = 0