Skip to content

Commit dfaa569

Browse files
committed
Record all benchmark results to JSON to not just last param set
1 parent b3e3283 commit dfaa569

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

benchmarks/benchmarking.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def run_benchmarks(
239239
"""
240240
results = {}
241241
for benchmark in benchmarks:
242-
results[benchmark.__name__] = {}
242+
results[benchmark.__name__] = []
243243
if print_results:
244244
print(benchmark.__name__)
245245
parameters = benchmark.parameters.copy()
@@ -257,7 +257,7 @@ def run_benchmarks(
257257
benchmark_function, number=number_runs, repeat=number_repeats
258258
)
259259
]
260-
results[benchmark.__name__] = {**parameter_set, "times / s": run_times}
260+
results_entry = {**parameter_set, "times / s": run_times}
261261
if MEMORY_PROFILER_AVAILABLE:
262262
baseline_memory = memory_profiler.memory_usage(max_usage=True)
263263
peak_memory = (
@@ -270,7 +270,8 @@ def run_benchmarks(
270270
)
271271
- baseline_memory
272272
)
273-
results[benchmark.__name__]["peak_memory / MiB"] = peak_memory
273+
results_entry["peak_memory / MiB"] = peak_memory
274+
results[benchmark.__name__].append(results_entry)
274275
if print_results:
275276
print(
276277
(
@@ -279,9 +280,9 @@ def run_benchmarks(
279280
else " "
280281
)
281282
+ f"min(time): {min(run_times):>#7.2g}s, "
282-
+ f"max(time): {max(run_times):>#7.2g}s, "
283+
+ f"max(time): {max(run_times):>#7.2g}s"
283284
+ (
284-
f"peak mem.: {peak_memory:>#7.2g}MiB"
285+
f", peak mem.: {peak_memory:>#7.2g}MiB"
285286
if MEMORY_PROFILER_AVAILABLE
286287
else ""
287288
)

0 commit comments

Comments
 (0)