3 ms·
Generators/Iterators are not just for asynchronous code. Generators may be a bit slower than iterating over an array, but arrays use more memory and put more pr
by gridlockd 6y ago
Generators/Iterators are not just for asynchronous code. Generators may be a bit slower than iterating over an array, but arrays use more memory and put more pressure on the garbage collector.
Your mileage will vary.
- deleted 6y ago[deleted]
- ricardobeat 6y agoTrue, though I suspect the impact in the case of a node list is negligible; in quick tests I couldn't detect any meaningful difference even while looping through 10k DOM elements.