I think this might be the same as
However, note that to benchmark functions properly, you need to use BenchmarkTools.jl and interpolate variables with a dollar sign. Otherwise your allocation count will be biased by the presence of global variables.