4 ms·
> You should always default to the more readable syntax (map/filter) and then refactor once you’ve determined where your bottlenecks are That's exactly what I
by _bxg1 7y ago
> You should always default to the more readable syntax (map/filter) and then refactor once you’ve determined where your bottlenecks are
That's exactly what I said:
> in hot paths converting to the iterate-and-mutate version is one of the most common optimizations I go in and make later on
> Transducers are also an option to get the map/filter syntax without losing and performance
All you need are iterators. Python, Rust, Haskell, most languages support performing these functions with iterators. There are even iterator libraries for JS, if you don't mind an extra dependency. But vanilla JS does not support this.