Inconsistency in Allocs reported by track-allocs vs BenchmarkTools

The allocations are likely caused by track-allocations. From the manual I linked above:

--track-allocation changes code generation to log the allocations, and so the allocations may be different than what happens without the option. We recommend using the allocation profiler instead.

The loop constructs rely heavily on inlining and subsequent compiler optimizations to avoid allocations. I think track-allocations might just hinder that with the extra code that tries to track allocations per line.

1 Like