diff options
author | hut <hut@lavabit.com> | 2010-06-22 00:50:58 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-06-22 00:50:58 +0200 |
commit | b290073bce2ed945a363132b45db34b934c31276 (patch) | |
tree | b4d473899debf10e9cc45ee38de9f490ba1c228e /test/all_benchmarks.py | |
parent | 6613bf4181f3d6d4b612e98e865192b73ebbe90c (diff) | |
parent | 3817c8b47e85d3644383182c2b3909a2dbdd0b3b (diff) | |
download | ranger-b290073bce2ed945a363132b45db34b934c31276.tar.gz |
Merge branch 'master' into preview
Diffstat (limited to 'test/all_benchmarks.py')
-rwxr-xr-x | test/all_benchmarks.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/test/all_benchmarks.py b/test/all_benchmarks.py index e1b47142..20f11ad8 100755 --- a/test/all_benchmarks.py +++ b/test/all_benchmarks.py @@ -30,15 +30,7 @@ if __name__ == '__main__': modules = (fname[:-3] for fname in os.listdir(sys.path[0]) \ if fname[:3] == 'bm_' and fname[-3:] == '.py') - benchmarks = [] # find all benchmark (class, methodname) pairs - for val in [__import__(module) for module in modules]: - for cls in vars(val).values(): - if type(cls) == type: - for methodname in vars(cls): - if methodname.startswith('bm_'): - benchmarks.append((cls, methodname)) - - for cls, methodname in benchmarks: + def run_benchmark(cls, methodname): full_method_name = "{0}.{1}".format(cls.__name__, methodname) if all(re.search(full_method_name) for re in regexes): method = getattr(cls(), methodname) @@ -51,3 +43,10 @@ if __name__ == '__main__': else: t2 = time.time() print("{0:60}: {1:10}s".format(full_method_name, t2 - t1)) + + for val in [__import__(module) for module in modules]: + for cls in vars(val).values(): + if type(cls) == type: + for methodname in vars(cls): + if methodname.startswith('bm_'): + run_benchmark(cls, methodname) |