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:
+9
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user