Understanding future performance profiles of Generators

# Jason Kuhrt (10 years ago)

Can anyone point me to good literature on projections or thoughts on future performance of Generators in JavaScript? I would like to develop heuristics and intuition about their use knowing that anything that is absolutely critical should of course be benchmarked by me, but also wanting enough knowledge to operate confidently in my choice of tool and techniques. For context I am concerned about the full stack so cannot focus on a single engine (V8 etc.).

Say for example that I wanted to write in a functional lazy-evaluation style; I want a sense within the order-of-magnitude at least for the general trade-offs I am making.

I don’t feel like justifying why I’m curious about this (as I seemed to have had to do on the Node IRC channel, sigh). So please just answer if you have constructive information to add. I understand this space is moving fast with patches that are increasing performance by orders of magnitude (e.g. code.google.com/p/v8/issues/detail?id=3928, code.google.com/p/v8/issues/detail?id=3928) so I’m more concerned with the longer term, 12-24+ months, how close will Generators get to regular functions in perf, etc.

# Brendan Eich (10 years ago)

Honestly, you can't count on promises from implementors. Best to make something kick-ass that pushes generator performance, gets adoption, and engines feel the heat. Until then, profile twice, cut once -- in all cases I've seen, the generator perf hardship was not on critical path.