Help fo working with Iters

Those are both slower than the for loop by quite a bit, and the second one is much slower than the first.

julia> @btime initial_trend_for_loop(series, 12)
  24.727 ns (1 allocation: 16 bytes)
-0.7847222222222222

julia> @btime initial_trend_tkf1(series, 12)
  96.970 ns (5 allocations: 416 bytes)
-0.7847222222222222

julia> @btime initial_trend_tkf2(series, 12)
  778.307 ns (13 allocations: 480 bytes)
-0.7847222222222222
1 Like

Ah, so it seems that mapreduce for multiple arrays is not as optimized as I hoped:

Fusing it would need something like https://github.com/JuliaLang/julia/pull/31020