BenchmarkTools.jl icon indicating copy to clipboard operation
BenchmarkTools.jl copied to clipboard

Incorrect(?) bar heights and plot labels from @benchmark

Open albheim opened this issue 4 years ago • 2 comments

Got some results that did not really seem correct, thought I would just drop them here.

Here the bar colored the same as the median text is the leftmost bar, reasonable since median is 924 and first bar is 923. But looking at the total "mass" of the bars it is clear that the median would not be in the first one. So either the plot seems to have cut off a very large first bar, or the median calculation seems wrong. I sadly could not inspect the data since I ran multiple things from a script and didn't assign the returned value, and when running it a second time it did not produce a similar plot.

julia> @benchmark clear_factors_simd!(x, 202, 500_000)
BenchmarkTools.Trial: 10000 samples with 34 evaluations.
 Range (min … max):  923.294 ns …  1.739 μs  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     924.059 ns              ┊ GC (median):    0.00%
 Time  (mean ± σ):   968.648 ns ± 93.556 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

  █▂▂▁▃   ▅▁▁▁ ▄    ▂    ▁     ▁     ▁                     ▃   ▁
  ███████▇███████▇▇▇█▇▇▆▆█▆▇▅▃▆█▅▅▄▄▄█▅▆▄▄▁▄█▄▃▄▃▄▃▇▄▄▁▃▃▃▁█▇▆ █
  923 ns        Histogram: log(frequency) by time      1.33 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.

The plot starts at 180 and ends at 1.69 so given the range I assume it is supposed to say 1.080 instead of 180 maybe?

julia> @benchmark clear_factors_turbo!(x, 202, 500_000)
BenchmarkTools.Trial: 10000 samples with 10 evaluations.
 Range (min … max):  1.075 μs …   4.692 μs  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     1.135 μs               ┊ GC (median):    0.00%
 Time  (mean ± σ):   1.187 μs ± 159.399 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

  █▇  ▁  ▅                                                     
  ██▃▅█▃▃█▄▂▆▆▂▂▃▃▂▂▃▃▂▂▂▃▂▂▂▂▃▂▂▂▃▃▂▂▂▂▃▃▂▂▂▂▄▃▂▂▂▂▂▂▂▂▂▁▂▁▂ ▃
  180 μs          Histogram: frequency by time        1.69 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.

This is BenchmarkTools v1.1.1 with Julia v1.6.2 on Linux.

albheim avatar Aug 06 '21 08:08 albheim

The 180us is very suspicious, perhaps ce89e45640b8523cc1be54b96c4722a271c80f2a or #245 relates to that. Regarding the bar height, they key thing is the log at the bottom. Clearly it can be confusing (see #237), but I haven't had a good idea yet on how to deal with it.

tecosaur avatar Aug 25 '21 04:08 tecosaur

Ahh okay. Once you know about the log thing I guess it can be useful, but without knowing it can make you very confused so I think it has to be very clear that it switches.

albheim avatar Aug 26 '21 12:08 albheim