I have the following code:
using KiteModels, StaticArrays, LinearAlgebra, BenchmarkTools
function test(vec)
KiteModels.norm(vec)
end
vec=MVector{3}([1.0,2,3])
test(vec)
bytes=@allocated test(vec)
println("Allocate $bytes bytes!")
@benchmark test($vec)
The macro @allocated
tells me my function would allocate 16 bytes, BenchmarkTools tells me I have zero allocations.
Which answer is correct?
Using LinearAlgebra.norm gives the same result, but it is slower (and more accurate).