Stream: helpdesk (published)

Topic: print @benchmark output in a .jl script


view this post on Zulip Rein Zustand (Jul 15 2021 at 06:27):

(BenchmarkTools.jl for searchability)

While I can do

julia> @benchmark 1+1
BechmarkTools.Trial: 10000 samples with 1000 evaluations.
 Range (min  max):  0.028 ns  3.154 ns   GC (min  max): 0.00%  0.00%
 Time  (median):     0.033 ns              GC (median):    0.00%
 Time  (mean ± σ):   0.034 ns ± 0.032 ns   GC (mean ± σ):  0.00% ± 0.00%

            
  ▃▁█▁█▁█▁█▁█▁█▁█▁█▁█▁▁▇▁▅▁▃▁▂▁▂▁▂▁▂▁▁▁▂▁▁▂▁▂▁▂▁▂▁▂▁▂▁▂▁▂▁▂ 
  028 ns         Histogram: frequency by time        055 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

in the REPL, how do I actually print out the histogram generated by the Trial object when I run it inside a script?

view this post on Zulip Mason Protter (Jul 15 2021 at 07:32):

You could use the display function


Last updated: Nov 06 2024 at 04:40 UTC