-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Some IFAs such as (rr2, rr, normal) cause allocations.
Strangely, window_hamming doesn't.
using IndexFunArrays
function main_bug(; N=4096)
els = rr2(Int, (N, N))
s = zero(eltype(els))
for e in els
if e > 100
s += 1
end
end
return s
end
#
julia> @time main_bug(; N=1000)
0.061883 seconds (3.00 M allocations: 106.787 MiB, 22.70% gc time)collecting fixes it, so it is related to IndexFunArrays.
using IndexFunArrays
function main_bug(; N=4096)
els = collect(rr2(Int, (N, N)))
s = zero(eltype(els))
for e in els
if e > 100
s += 1
end
end
return s
end
#
julia> @time main_bug(; N=1000)
0.007953 seconds (7 allocations: 7.630 MiB, 84.24% gc time)Metadata
Metadata
Assignees
Labels
No labels