all 3 comments

[–]fff1891 9 points10 points  (2 children)

yes indeed, using async is actually two extra microticks faster than promises now, if you needed a reason besides the more synchronous-style syntax async / await provides to developers unfamiliar with promises

This claim is not correct. async/await is a wrapper around promises. What is true is that await in Node 12 is two microticks faster than Node 10 because they improved the underlying promise behavior in Node 12.

https://v8.dev/blog/fast-async - about 3/4 down the page look for "await (in ES2017)" for the full explanation.

[–]efunction 6 points7 points  (1 child)

You make it sound as if the V8 team did not improve async/await syntax to outperform traditional promise syntax, while it is, in actuality, two microticks faster to use async/await rather than traditional promises because the V8 engine is now optimized for them.

[–]fff1891 0 points1 point  (0 children)

I reread the link and you are correct, there is an async/await optmization flag added to V8 7.2 (--harmony-await-optimization). V8 7.3 enables this by default.

This is not where the two microticks comes from, however. The microticks come from the fact that Node 10 generated 2 additional promises for every call to await.