How to lazily filter an iterator while also applying a function to it

Nonetheless, it can apparently made a difference: See this post. It seems that, at one point at least, the presence of an assert triggers a compiler optimization that wouldn’t be triggered otherwise.

Fair point. But Julia (to my knowledge) does nothing special with @assert, unlike assertions myvec::Vector etc. Afterwards, LLVM et. al. are indeed very clever sometimes… especially when you are trying to test out a trivial example!