EDIT: 2021-01-10
Fixed here: nodejs/node#34291
EDIT: 2020-07-10
Explanation here: nodejs/node#33384 (comment)
By benchmarking promises against different version of Node.js, I noticed a performance drop in traditional promises (then
/catch
) between Node.js 10 and Node.js 12.
With further investigation I'm now able to say that the performance drop occur between v8 7.4
(Node.js 12.0.0
) and v8 7.5
(Node.js 12.5.0
).
The performance drop is still present in recent version of v8 (tested with v8 8.1
on Node.js 14.2.0
)
Promises are between 3x and 5x slower in v8 7.5
than in v8 7.4
and they are still 2x slower in v8 8.1
You can run the benchmarks by yourself by executing bash run-benchmark.sh
. Those benchmark have been realized on a Scaleway GP1-XS instance.
With 50k promises:
Node.js 12.0.0 (v8 7.4) | Node.js 12.5.0 (v8 7.5) | Node.js 14.2.0 (v8 8.1) | node-v15.0.0 (v8 8.3) | |
---|---|---|---|---|
Promise Native | 5482 | 10819 | 10203 | 9509 |
Async Await | 4237 | 8682 | 5934 | 7891 |
With 100k promises:
Node.js 12.0.0 (v8 7.4) | Node.js 12.5.0 (v8 7.5) | Node.js 14.2.0 (v8 8.1) | node-v15.0.0 (v8 8.3) | |
---|---|---|---|---|
Promise Native | 13616 | 37721 | 27043 | 30658 |
Async Await | 10150 | 19357 | 11529 | 22605 |
See the complete data on Google Sheet