Re:Async Iterators: These Promises Are Killing My Performance
by kevincox on Sunday August 27, 2017 @06:43PM
(#15113215)
Why are you generating the promise in the first place if there are no listeners? Why don't you return a function which can be used to generate the promise instead?
[ Parent
| on HN ]
Re:Async Iterators: These Promises Are Killing My Performance
by amelius on Sunday August 27, 2017 @07:12PM
(#15113331)
I'm not sure what would be the advantage.
The number of listeners can go up and down during the computation. When that number reaches zero, the computation needs to be stopped.
When the number becomes nonzero again, the computation needs to be restarted.
Those are the requirements, basically.