Open chunjiw opened 3 months ago
It seems the @time
reports no allocations as the compiler can see that s1
is constructed and then the first field is accessed and so can figure out that the type of s1()
is Float64
. Whilst for BenchmarkTools the s1()
call happens in a non-inlined function so it cannot do the same optimisation.
It's not obvious that it could be worked around, nor that we would want to.
MWE:
The output I see is
So when the field is a vector,
@btime
reports wrong allocation, assuming@time
and@allocated
are right. This may be related to https://github.com/JuliaLang/julia/issues/53694 but I'm not sure.