> Love it! I get your point much better now. I'll be using it in the future > :).
:) Yes I was probably a bit succint. > Re Iterators, yes, your guess is spot on---it's those pesky tuples (which > are > way better than they used to be, see > https://github.com/JuliaLang/julia/pull/4042). In high performance code, > iterators from Iterators are usually a bottleneck. OK thanks. I actually used a simpler imap (which handles only single argument functions) than in Iterators.jl, getting much better results, but still 48*lenght(x) bytes allocated, and slower (roughly by x10) than sumf. > The recently-added iterator > macros can sidestep that problem in some circumstances, but not without > internal changes. Perhaps one option would be to explore using them more > widely in Iterators? Maybe. For my tests I annotated the functions with the ":inline" hint (from base/inference.jl, disabled in master, but it's 4 lines to uncomment), which is "supposed" to inline the calls to the imap wrapper functions, with no gain in this case. So I would believe that the overhead is caused only by heap allocations (+ gc), and not by not inlining.