Hacker News new | ask | show | jobs
by azangru 64 days ago
> the intermediate objects are still created

Yeah; this is what the new iterator methods were intended to solve

https://x.com/MozDevNet/status/2029527411424219254

2 comments

Basically?

  // This type of usage creates intermediates
  array.map().filter()
  // But these would not?
  array.values().map().filter().toArray()
  array.values().reduce()
unfortunately iterators have their own set of overheads and it's not clear that these new methods are any faster for most use cases.