diff options
author | Greg Noel <GregNoel@tigris.org> | 2010-03-25 04:14:28 (GMT) |
---|---|---|
committer | Greg Noel <GregNoel@tigris.org> | 2010-03-25 04:14:28 (GMT) |
commit | 22d352500f1cd6bd0c53d788a5dc44a1fefa676e (patch) | |
tree | 0984fd581082c27cfbfbb7f94d5751b0e6fd2741 /bench/bench.py | |
parent | 75ac32ac8e32076e25b72a19eb56340cc585fa4e (diff) | |
download | SCons-22d352500f1cd6bd0c53d788a5dc44a1fefa676e.zip SCons-22d352500f1cd6bd0c53d788a5dc44a1fefa676e.tar.gz SCons-22d352500f1cd6bd0c53d788a5dc44a1fefa676e.tar.bz2 |
Move 2.0 changes collected in branches/pending back to trunk for further
development. Note that this set of changes is NOT backward-compatible;
the trunk no longer works with Python 1.5.2, 2.0, or 2.1.
Diffstat (limited to 'bench/bench.py')
-rw-r--r-- | bench/bench.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/bench/bench.py b/bench/bench.py index ef60535..e076e43 100644 --- a/bench/bench.py +++ b/bench/bench.py @@ -23,6 +23,7 @@ # # This will allow (as much as possible) us to time just the code itself, # not Python function call overhead. +from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS import getopt import sys @@ -93,10 +94,10 @@ exec(open(args[0], 'rU').read()) try: FunctionList except NameError: - function_names = filter(lambda x: x[:4] == FunctionPrefix, locals().keys()) + function_names = [x for x in locals().keys() if x[:4] == FunctionPrefix] function_names.sort() - l = map(lambda f, l=locals(): l[f], function_names) - FunctionList = filter(lambda f: type(f) == types.FunctionType, l) + l = [locals()[f] for f in function_names] + FunctionList = [f for f in l if type(f) == types.FunctionType] IterationList = [None] * Iterations @@ -104,7 +105,7 @@ def timer(func, *args, **kw): results = [] for i in range(Runs): start = Now() - apply(func, args, kw) + func(*args, **kw) finish = Now() results.append((finish - start) / Iterations) return results @@ -119,7 +120,7 @@ for func in FunctionList: print func.__name__ + d + ':' for label, args, kw in Data: - r = apply(timer, (func,)+args, kw) + r = timer(func, *args, **kw) display(label, r) # Local Variables: |