@@ -5,7 +5,7 @@ using Pkg
5
5
Pkg. activate (@__DIR__ )
6
6
using PkgBenchmark, BenchmarkTools, Statistics
7
7
8
- const N = 1 # _000
8
+ const N = 1_000
9
9
10
10
import Base: - , /
11
11
function - (a:: BenchmarkTools.TrialEstimate , b:: BenchmarkTools.TrialEstimate )
@@ -38,6 +38,22 @@ function postprocess(results::BenchmarkGroup)
38
38
end
39
39
results
40
40
end
41
+ function postprocess_no_div (results:: BenchmarkGroup )
42
+ for (op, op_group) in results. data
43
+ op_results = op_group. data
44
+ for (type, type_group) in op_results
45
+ benchresults = type_group. data
46
+ if op == " identity"
47
+ # For :identity, bench and base are identical so we don't want to subtract.
48
+ op_results[type] = median (benchresults[" bench" ])
49
+ else
50
+ op_results[type] = median (benchresults[" bench" ]) - median (benchresults[" base" ])
51
+ end
52
+ end
53
+ end
54
+ results
55
+ end
56
+
41
57
42
58
function runbench ()
43
59
bench_results = withenv (" BENCH_NUM_ITERS" => string (N)) do
49
65
50
66
function judgebench (target:: Union{String, BenchmarkConfig} , baseline:: Union{String, BenchmarkConfig} )
51
67
bench_results = withenv (" BENCH_NUM_ITERS" => string (N)) do
52
- judge (" FixedPointDecimals" , target, baseline; f= identity, postprocess= postprocess )
68
+ judge (" FixedPointDecimals" , target, baseline; f= identity, postprocess= postprocess_no_div )
53
69
end
54
70
end
55
71
function judgebench (baseline:: Union{String, BenchmarkConfig} )
0 commit comments