Till Schneidereit (2015-02-16T18:46:57.000Z)
On Mon, Feb 16, 2015 at 7:35 PM, Brendan Eich <brendan at mozilla.org> wrote:

> Andreas Rossberg wrote:
>
>> On 16 February 2015 at 15:41, Andrea Giammarchi <
>> andrea.giammarchi at gmail.com <mailto:andrea.giammarchi at gmail.com>> wrote:
>>
>>     Common pattern is to poll.next() a yield until its `done` property
>>     is `true` so that a value can be used.
>>
>>     This is I believe the common case that will create thousands of
>>     objects to be quickly trashed as garbage ... so I was wondering if
>>     those are all needed
>>
>>
>> Er, I don't think this is the common use case at all. You iterate over
>> something to process values, otherwise there isn't much point in using
>> iterators in the first place.
>>
>> /Andreas
>>
>
> Right.
>
> Instead of coming up with some bogo-API with a mutable singleton object
> having pigeon-hole problems, how about engine hackers actually do some
> optimizing? I remember in the Mosaic days, Eric Bina replied to someone who
> decried the difficulty of fixing some ostensibly hard bug by writing the
> patch. :-|
>

FWIW I have a patch pending in bug 1129313[1] that makes `for .. of` 4x as
fast for Maps. That is without even having scalar replacement working yet,
which probably explains why v8 is still 2x as fast. JSC is about 10% slower
than patched SpiderMonkey. As explained in comment 12 of that bug, I
haven't found a way to do the same thing - iterating over all entries
(i.e., properties) and getting both key and value - anywhere nearly as fast
on a plain object. That probably means I'm overlooking something, but at
the very least I think the concerns about this being hard to optimize might
be slightly overblown.


[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1129313
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150216/30749783/attachment.html>
d at domenic.me (2015-02-21T00:40:16.104Z)
FWIW I have a patch pending in [bug 1129313][1] that makes `for .. of` 4x as
fast for Maps. That is without even having scalar replacement working yet,
which probably explains why v8 is still 2x as fast. JSC is about 10% slower
than patched SpiderMonkey. As explained in comment 12 of that bug, I
haven't found a way to do the same thing - iterating over all entries
(i.e., properties) and getting both key and value - anywhere nearly as fast
on a plain object. That probably means I'm overlooking something, but at
the very least I think the concerns about this being hard to optimize might
be slightly overblown.


[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1129313