From b679f4b85962effa6a22fa7b944a695d020cb9a4 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Fri, 23 Apr 2021 11:26:27 +0200 Subject: benchmark: Improve output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- utils/benchmark.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'utils/benchmark.py') 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): -- cgit v1.2.3