Re:Async Iterators: These Promises Are Killing My Performance
by wereHamster on Sunday August 27, 2017 @03:13PM
(#15112196)
It doesn't matter which version of node. The fact that promises must be resolved in the next tick is baked into the spec, no upgrade of node will ever improve that situation.
[ Parent
| on HN ]
Re:Async Iterators: These Promises Are Killing My Performance
by jkrems on Sunday August 27, 2017 @05:59PM
(#15113050)
> The fact that promises must be resolved in the next tick is baked into the spec
From all I know, that statement is false. Promises aren't resolved in the next tick. They should be resolved as part of the microtask queue which can happen at the end of the tick (recursively).
Promise.resolve()
.then(() => console.log('1'))
.then(() => console.log('2'))
.then(() => console.log('still the same tick!'));
setTimeout(() => console.log('timeout happening in the next tick'), 0);
Result: 1
2
still the same tick!
timeout happening in the next tick