Does calling a function with no memory allocations create an allocation?

Also, be careful benchmarking in global scope. It’s safest to use e.g. BenchmarkTools.jl and do

@btime take_measurement!($measurements,1.0)

where @btime will automatically run the benchmark multiple times to get good timing resolution, and the $ will eliminate any cost from using a global variable measurements. (You could also use the @b macro from the Chairmarks.jl package.)

2 Likes