>
> There's a complicated limit to when you want to fuse loops – at some point
> multiple iterations becomes better than fused loops and it all depends on
> how much and what kind of work you're doing. In general doing things lazily
> does not cut down on allocation since you have to allocate the
> representation of the operations that you're deferring and close over any
> values that they depend on.
>
This particular example only works out so well because the iterable is so
> simple that the compiler can eliminate the laziness and do the eager loop
> fused version for you. This will not generally be the case.


Thank you for taking so much time to explain and for your patience!


> You're welcome to experiment (and Julia's type system makes it pretty easy
> to do so), but I think that you'll quickly find that more laziness is not a
> panacea for performance problems.


My question came partly from Python3 having lazy map and reduce. But having
the choice is good and in Julia all laziness can be provided now by imap
etc. If someone has an (self-contained) example where lazy element-wise
computations is worse than eager, please post! (I'm interested in
understanding better the above mentioned "limit")

Reply via email to