News for hackers. Stuff that matters.
Re:Async Iterators: These Promises Are Killing My Performance by amelius on Sunday August 27, 2017 @05:51PM (#15113016)
But a cancel() method would not be a "clean" solution if there potentially are multiple listeners.

I really want to compute things if and only if there are listeners.

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?
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.

Re:Async Iterators: These Promises Are Killing My Performance by skybrian on Sunday August 27, 2017 @08:24PM (#15113603)
For that use case, maybe an event emitter would work better?