Performance of native ES2015 promises and ES2016 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 w/ Bluebird Promises = ES2016 Chrome V8 Async Functions with Bluebird 3.5.0 Promises
  • Async functions w/ Native Promises = ES2016 Chrome V8 Async Functions with Chrome V8 Promises

Bluebird 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.2 Argon 4.5.103.46 1287 190.12
v6.10.2 Boron 5.1.281.95 1506 144.93
v7.10.0 - 5.5.372.43 1206 164.36
v8.1.2 w/ util.promisify (Carbon) 5.8.283.39 589 69.51

Notes: performance of native promises in Node.js v8 improves by a factor of 2.05-2.55 with memory utilization dropping by a factor of 2.08-2.75 in comparison with the previous versions of Node.js.

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

Node.js v8.1.2 (Carbon) / V8 5.8.283.41

Async Type Time, ms Memory, MB
Callbacks 107 31.19
Bluebird Promises 336 48.25
Async functions w/ Bluebird Promises 529 70.70
Native Promises w/ util.promisify 589 69.51
Async functions w/ Native Promises w/ util.promisify 632 72.95

Notes: native ES2015 Chrome V8 promises in Node.js 8 perform 75% slower than Bluebird promises using 43% more memory. In contrast, native ES2016 async functions in Node.js 8 perform 20% slower than async functions backed by Bluebird promises, but use 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.2 Argon 4.5.103.46 3269 496.14
v6.10.2 Boron 5.1.281.95 3365 447.03
v7.9.0 - 5.5.372.43 3087 399.39
v8.1.2 w/ util.promisify (Carbon) 5.8.283.39 1326 194.98

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.1.2 (Carbon) / V8 5.8.283.41

Async Type Time, ms Memory, MB
Callbacks 423 80.06
Bluebird Promises 650 108.65
Async Functions w/ Bluebird Promises 765 119.32
Native Promises w/ + util.promisify 1326 194.98
Async Functions w/ Native Promises w/ util.promisify 1339 202.16

Notes: native Chrome V8 ES2015 promises perform 2 times slower than Bluebird promises using 79% more memory. Native ES2016 async functions in Node.js 8 perform 75% slower, using 69% more memory than async functions backed by Bluebird promises.

Conclusion

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