Here’s a basic streaming mean
function (called avg
for convenience):
function avg(itr)
a = zero(eltype(x))
for (i, x) in enumerate(itr)
a += (x - a) / i
end
return a
end
Why does it allocate so much on a skipmissing
iterator? Is there some issue with the skipmissing
iterator implementation?
julia> x = rand(Float32, 100_000_000); sx = skipmissing(x);
julia> @btime avg($sx);
10.356 s (499999489 allocations: 7.45 GiB)