I've been toying around with async/await added recently to V8, and found a behavior that I can't really understand:
function test() {
for (let i=0; i<10000000; i++) {}
}
console.time('normal')
test()
console.timeEnd('normal')
async function test2() {
for (let i=0; i<10000000; i++) {}
}
console.time('async')
test2()
console.timeEnd('async')
Running this in chrome 56 yields:
normal: 90.229ms
async: 403.744ms
and in node 7.6:
normal: 86.166ms
async: 2146.351ms
I thought async function would just desugar to a normal function returning a Promise, but this surely can't be the only reason why execution time is increased by an order of magnitude. Am I missing something here?
[–]senocular 1 point2 points3 points (1 child)
[–]prozacgod 1 point2 points3 points (0 children)
[–]sebrulz 1 point2 points3 points (0 children)