Benchmark of .filter().map() on arrays against Iterator.from(x).filter().map().toArray().
- Full pass: array methods win in most scenarios, about 2x on typical sizes and 2x to 3x on long chains.
- Early termination (
take(n),find): iterator helpers win by orders of magnitude.take(10)on 1e6 elements took 0.9 µs against 18 ms. - Hand-written generator chains were the slowest in nearly every case.
- Bun (JavaScriptCore) is slower with iterator helpers than Node and Deno (V8): up to 7x on a 4-step chain.
- Run each runtime alone. Parallel runs skew the timings.