summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-04-23 11:26:27 +0200
committerMichał Górny <mgorny@gentoo.org>2021-04-23 11:26:27 +0200
commitb679f4b85962effa6a22fa7b944a695d020cb9a4 (patch)
tree78c5c8b4916e4aef9829d38c346814aab278a1b8 /utils
parent85b0a3170989d61e06e385a660614f3d1ab36d20 (diff)
downloadgemato-b679f4b85962effa6a22fa7b944a695d020cb9a4.tar.gz
benchmark: Improve output
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'utils')
-rwxr-xr-xutils/benchmark.py8
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):