Tullio.jl icon indicating copy to clipboard operation
Tullio.jl copied to clipboard

Mystery allocation in scalar reduction

Open mcabbott opened this issue 4 years ago • 0 comments

From https://discourse.julialang.org/t/avoid-memory-allocation-in-passing-arrays/66560

julia> M = [1 2; 3 4.0];

julia> @btime @tullio _ = $M[q,1] * $M[q,1]
  22.381 ns (1 allocation: 16 bytes)
10.0

julia> @btime @tullio _ = $M[q,1] * $M[q,1]  threads=false
  1.583 ns (0 allocations: 0 bytes)
10.0

mcabbott avatar Aug 17 '21 23:08 mcabbott