Skip to content

Commit 2278295

Browse files
committed
bench: align metadata with median timing sample (#66)
1 parent dbcc34f commit 2278295

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

benchmarks/knapsack/KnapsackBenchmark.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,12 @@ function benchmark_repeated(f; samples)
339339
trial = BenchmarkTools.run(benchmark; warmup = false)
340340
estimate = BenchmarkTools.median(trial)
341341
measured_outputs = last(outputs, min(samples, length(outputs)))
342+
length(measured_outputs) == length(trial.times) || error(
343+
"could not associate every benchmark timing with its measured output",
344+
)
345+
median_index = sortperm(trial.times)[cld(length(trial.times), 2)]
342346
return (
343-
value = last(measured_outputs),
347+
value = measured_outputs[median_index],
344348
outputs = measured_outputs,
345349
time = estimate.time / 1e9,
346350
gctime = estimate.gctime / 1e9,

0 commit comments

Comments
 (0)