`filter` is doing too much work
Closed this issue · 0 comments
robrix commented
Swift.filter
is strict, meaning that it constructs an intermediate collection. We only need forward iteration via SequenceType
, so lazy()
should be a significant speedup since it won’t allocate as much.
I hypothesize that this will be significant with short sets and accept-all predicates, and even more significant with long sets. I further hypothesize that it will be insignificant with reject-all predicates.