I use BenchmarkTools like this to save and compare performance:
using BenchmarkTools
b = @benchmark sum(0:2:1_000_000)
t = sum(b.times)/length(b.times)
println(t)
The issue is that for some functions it returns times in seconds (s) for others in milliseconds (ms), microseconds (μs) or nanoseconds (ns). I have not found a way to figure out in what unit (s, ms, μs, ns) the times are returned. I need this to compare performance performance over different functions.
Any idea how to solve this or the set options to always get times in ns?
The printing is done in varying units. But if you want to access the actual times programmatically by manipulating the output of @benchmark or @belapsed, indeed they are always in nanoseconds.
It preserves the keyword arguments samples, evals, and seconds. Unlike BenchmarkTools, the seconds argument is honored even as it drops down to the order of 30μs
It seems great (actually both packages), also from Lilith: BasicAutoloads.jl (helping for both packages and more). Everything Lilith does/touches seems great!