summaryrefslogtreecommitdiff
path: root/utils/benchmark.py
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-09-26 13:00:56 +0200
committerMichał Górny <mgorny@gentoo.org>2022-09-26 13:03:05 +0200
commite907b0f04354873316311072da572943abb6281a (patch)
tree1f8129299e812a3aa2fe5e1e9a9c823ce58772c7 /utils/benchmark.py
parent572da07948b921feb35af5b098f50af7d8dea99a (diff)
downloadgemato-e907b0f04354873316311072da572943abb6281a.tar.gz
Modernize via pyupgrade
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'utils/benchmark.py')
-rwxr-xr-xutils/benchmark.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/utils/benchmark.py b/utils/benchmark.py
index 5eb4d8d..8bca803 100755
--- a/utils/benchmark.py
+++ b/utils/benchmark.py
@@ -11,12 +11,12 @@ import gemato.hash
def benchmark_one(path, hashes):
f = lambda: gemato.hash.hash_path(path, hashes)
- print("{} -> [ ".format(hashes), end='', flush=True)
+ print(f"{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)
+ print(f"{t:.4}", end=" ", flush=True)
results.append(t)
- print("] -> min: {:.4}".format(min(results)))
+ print(f"] -> min: {min(results):.4}")
def benchmark(path, hash_sets):
@@ -35,7 +35,7 @@ def benchmark(path, hash_sets):
if __name__ == '__main__':
if len(sys.argv) < 2:
- print('Usage: {} <test-file> [<hash-set>...]'.format(sys.argv[0]))
+ print(f'Usage: {sys.argv[0]} <test-file> [<hash-set>...]')
sys.exit(1)
benchmark(sys.argv[1], sys.argv[2:])