diff options
Diffstat (limited to 'utils/benchmark.py')
-rwxr-xr-x | utils/benchmark.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/utils/benchmark.py b/utils/benchmark.py index 1003c1a..5eb4d8d 100755 --- a/utils/benchmark.py +++ b/utils/benchmark.py @@ -11,8 +11,12 @@ import gemato.hash def benchmark_one(path, hashes): f = lambda: gemato.hash.hash_path(path, hashes) - t = timeit.repeat(f, number=1) - print("{} -> {}".format(hashes, t)) + print("{} -> [ ".format(hashes), end='', flush=True) + results = [] + for t in (timeit.timeit(f, number=1) for i in range(5)): + print("{:.4}".format(t), end=" ", flush=True) + results.append(t) + print("] -> min: {:.4}".format(min(results))) def benchmark(path, hash_sets): |