Performance of native ES2015 promises and ES2017 async functions in Node.js v8

Platform info:

  • Windows_NT 10.0.15063 x64
  • Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz × 4

Async types tested:

  • Bluebird Promises = Bluebird 3.5.0 Promises
  • Native Promises = ES2015 Chrome V8 Promises
  • Async functions = ES2017 Chrome V8 Async Functions

Benchmarks:

  • Doxbee sequential
  • Madeup parallel

Doxbee sequential

./bench doxbee

Performance of Chrome V8 Promises in current versions of Node.js

Node.js LTS Chrome V8 Time, ms Memory, MB
v4.8.4 Argon 4.5.103.47 1433 185.33
v6.11.2 Boron 5.1.281.103 1468 141.76
v8.4.0 + util.promisify (Carbon) 6.0.286.52 730 61.86

Notes: performance of native promises in Node.js v8 improves by a factor of 2 with memory utilization dropping by a factor of 2.3-3.0 in comparison with the previous versions of Node.js.

Performance of Callbacks vs Promises vs Async Functions in Node.js v8

Node.js v8.4.0 (Carbon) / V8 6.0.286.52

Async Type Time, ms Memory, MB
Callbacks 161 33.54
Bluebird Promises 372 41.32
Async functions + Bluebird promisify 583 72.79
Native Promises + util.promisify 730 61.86
Async functions + util.promisify 743 79.89

Notes: native ES2015 Chrome V8 promises in Node.js v8 perform roughly 2 times slower than Bluebird promises using 50% more memory. In contrast, native ES2017 async functions in Node.js v8 perform only 30% slower than async functions with Bluebird promisify using roughly the same amount of memory.

Madeup parallel

./bench parallel

Performance of Chrome V8 Promises in current versions of Node.js

Node.js LTS Chrome V8 Time, ms Memory, MB
v4.8.4 Argon 4.5.103.47 3269 496.14
v6.11.2 Boron 5.1.281.103 3156 447.39
v8.4.0 + util.promisify (Carbon) 6.0.286.52 1274 195.23

Notes: performance of native promises in Node.js v8 improves by a factor of 2.3-2.5 with memory utilization dropping by a factor of 2.1-2.6 in comparison with the previous versions of Node.js.

Performance of Callbacks vs Promises vs Async Functions in Node.js v8

Node.js v8.4.0 (Carbon) / V8 6.0.286.52

Async Type Time, ms Memory, MB
Callbacks 376 73.55
Bluebird Promises 600 106.58
Async Functions + Bluebird promisify 636 114.67
Async Functions + util.promisify 1247 202.34
Native Promises + util.promisify 1274 195.23

Notes: both native Chrome V8 ES2015 promises and ES2017 async functions perform roughly 2 times slower than Bluebird promises using almost 2 times more memory.

Conclusion

Node.js v8 comes with significantly improved performance of native ES2015 promises and ES2017 async functions, further boosted by the introduction of native util.promisify.