diff options
author | Ryan Williams <rdw@lindenlab.com> | 2010-01-21 00:37:03 -0500 |
---|---|---|
committer | Ryan Williams <rdw@lindenlab.com> | 2010-01-21 00:37:03 -0500 |
commit | e60a78444c0be333f49232ebc9bcab0be261e35a (patch) | |
tree | 5bd58a26157f2eedd804351c7dc5b11dcd1ee2f1 /benchmarks/__init__.py | |
parent | 5b8acc850fe8ac2becc79c9053db1ac9e0ca6296 (diff) | |
download | eventlet-e60a78444c0be333f49232ebc9bcab0be261e35a.tar.gz |
Added debug control over exceptions in greenpool, benchmarks directory.
Diffstat (limited to 'benchmarks/__init__.py')
-rw-r--r-- | benchmarks/__init__.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/benchmarks/__init__.py b/benchmarks/__init__.py new file mode 100644 index 0000000..b2ca444 --- /dev/null +++ b/benchmarks/__init__.py @@ -0,0 +1,24 @@ +import gc +import timeit +import random + +def measure_best(repeat, iters, + common_setup='pass', + common_cleanup='pass', + *funcs): + funcs = list(funcs) + results = dict([(f,[]) for f in funcs]) + + for i in xrange(repeat): + random.shuffle(funcs) + for func in funcs: + gc.collect() + t = timeit.Timer(func, setup=common_setup) + results[func].append(t.timeit(iters)) + common_cleanup() + + best_results = {} + for func, times in results.iteritems(): + best_results[func] = min(times) + return best_results +
\ No newline at end of file |