Benjamin (Inglor) Gruenbaum (2015-02-15T14:16:16.000Z)
> In my testing (and in my theory, as an absolute) this is a real
performance defect in the spec and it will make iterators inferior to
all other forms of sequence iteration, to the extent that they may end
up being used very rarely, and developers will be biased away from Map
and Set as a result.

Why?

Allocating a new object isn't really expensive, in cases it is and it
introduces GC pressure a clever engine can optimize it away by not really
allocating a new object where it is not required. Your suggestion can be
fully implemented by the engine already in the cases you speak of (where no
reference is kept) so there is no real speed benefit from it performance
wise. However in the case an iteration result is kept for later use this
can be destructive and create unpredictable results.

Also - of course for... of and iterating iterators right now is slower than
iterating in ways that have been there for years. Modern JS engines usually
add support for features and only then optimize them.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150215/42cde06d/attachment.html>
d at domenic.me (2015-02-21T00:40:41.822Z)
> In my testing (and in my theory, as an absolute) this is a real
> performance defect in the spec and it will make iterators inferior to
> all other forms of sequence iteration, to the extent that they may end
> up being used very rarely, and developers will be biased away from Map
> and Set as a result.

Why?

Allocating a new object isn't really expensive, in cases it is and it
introduces GC pressure a clever engine can optimize it away by not really
allocating a new object where it is not required. Your suggestion can be
fully implemented by the engine already in the cases you speak of (where no
reference is kept) so there is no real speed benefit from it performance
wise. However in the case an iteration result is kept for later use this
can be destructive and create unpredictable results.

Also - of course for... of and iterating iterators right now is slower than
iterating in ways that have been there for years. Modern JS engines usually
add support for features and only then optimize them.