BenchmarkTools.jl
BenchmarkTools.jl copied to clipboard
common histogram bounds when displaying multiple benchmarks
@timholy just implemented manual histogram bounds in https://github.com/JuliaCI/BenchmarkTools.jl/pull/255, but it occurred to me that when you display multiple benchmarks together (in an array, for example), then it would be even nicer to figure out common histogram bounds for all the benchmarks.
Looks like this currently:
julia> b1 = @benchmark sum(b) setup=(b = rand(Int32, 10^4));
julia> b2 = @benchmark sum(a) setup=(a = reinterpret(reshape, Int32, rand(UInt8, 4, 10^4)));
julia> [b1, b2]
2-element Vector{BenchmarkTools.Trial}:
913.368 ns
845.129 ns
This must come from the 2-arg show.
Ah yes, that makes sense—if you have a bunch of benchmarks in an array, you probably want a terse display. There could be a specific function to display a collection of benchmarks as a comparison.