is an iterator allowed to reuse the same "state" object?
brendan at mozilla.org
Wed Apr 29 16:37:02 UTC 2015
Andreas Rossberg wrote:
> On 29 April 2015 at 02:21, John Lenz <concavelenz at gmail.com
> <mailto:concavelenz at gmail.com>> wrote:
> I missed it, thanks. I know things will improve in time but I'm
> just coming from a discussion with folks complaining about the
> performance of generators and GC overhead in real code with Chrome
> and Firefox relative to simple hand written loops.
> Note that there is a huge difference between optimising iterators (in
> particular, for-of), and optimising generators. I expect that VMs will
> start getting better on the former relatively soon, for iterators that
> are not generators. Making generators fast is a much more complicated
But in either case, escape analysis and object allocation elimination
can avoid the flood of eden objects John cited, right?
I'm inferring your comment about generator optimization hardship has to
do with a function that yields -- whose CFG has multiple entry points
and whose activation record must live in the heap.
More information about the es-discuss