Re:Async Iterators: These Promises Are Killing My Performance
by skybrian on Sunday August 27, 2017 @08:30PM
(#15113621)
Yes, it does need to be delayed until the stack is unwound, but it doesn't need to be delayed until after any events already on the main event queue. (I'm not sure what "the next turn of the event loop" means in the presence of multiple queues.)
console.log("First");
promise.then(_ => console.log("Third"));
console.log("Second");
This means that even if `promise` is fulfilled already the callback must be delayed at least until the next turn of the event loop.