Created
October 25, 2019 23:20
-
-
Save AlexChambers/2604ba18f18d351a3c03503e22682703 to your computer and use it in GitHub Desktop.
Promise vs Callback vs Async/await benchmark 2019
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Script used: | |
https://github.com/kyrylkov/promise-async-performance | |
Platform info: | |
Darwin 19.0.0 x64 | |
Node.JS 10.15.3 | |
V8 6.8.275.32-node.51 | |
Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz × 8 | |
Conclusion: | |
The performance gap is closing between callbacks and native async. | |
- 2018 - Node 8, callbacks are 300% faster ([source](https://gist.github.com/ColonelBundy/d57fb9cd16eb87b2d4d932acc1055b30)) | |
- 2019 - Node 10, callbacks are 110% faster | |
- 2019 - Node 12, callbacks are 75% faster | |
This was an updated follow up on the performance benchmark from [kyrylkov](https://github.com/kyrylkov/promise-async-performance) and modeled after the Gist from [ColonelBundy](https://gist.github.com/ColonelBundy/d57fb9cd16eb87b2d4d932acc1055b30). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Doxbee sequential | |
benchmarking ./doxbee-sequential/async-bluebird.js | |
{"time":389,"mem":49.85546875,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/async-es2017-native.js | |
{"time":417,"mem":69.4453125,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/async-es2017-util.promisify.js | |
{"time":427,"mem":62.96875,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/callbacks-baseline.js | |
{"time":198,"mem":24.7421875,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/promises-bluebird-generator.js | |
{"time":295,"mem":36.4765625,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/promises-bluebird.js | |
{"time":326,"mem":45.890625,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/promises-es2015-native.js | |
{"time":514,"mem":76.4453125,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/promises-es2015-util.promisify.js | |
{"time":450,"mem":70.84375,"errors":0,"lastErr":null} | |
results for 10000 parallel executions, 1 ms per I/O op | |
file time(ms) memory(MB) | |
callbacks-baseline.js 198 24.74 | |
promises-bluebird-generator.js 295 36.48 | |
promises-bluebird.js 326 45.89 | |
async-bluebird.js 389 49.86 | |
async-es2017-native.js 417 69.45 | |
async-es2017-util.promisify.js 427 62.97 | |
promises-es2015-util.promisify.js 450 70.84 | |
promises-es2015-native.js 514 76.45 | |
Madeup parallel | |
benchmarking ./madeup-parallel/async-bluebird.js | |
{"time":508,"mem":104.8125,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/async-es2017-native.js | |
{"time":1102,"mem":226.875,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/async-es2017-util.promisify.js | |
{"time":1238,"mem":223.54296875,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/callbacks-baseline.js | |
{"time":355,"mem":77.046875,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/promises-bluebird-generator.js | |
{"time":612,"mem":109.45703125,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/promises-bluebird.js | |
{"time":596,"mem":103.953125,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/promises-es2015-native.js | |
{"time":1298,"mem":228.75,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/promises-es2015-util.promisify.js | |
{"time":1484,"mem":218.78515625,"errors":0,"lastErr":null} | |
results for 10000 parallel executions, 1 ms per I/O op | |
file time(ms) memory(MB) | |
callbacks-baseline.js 355 77.05 | |
async-bluebird.js 508 104.81 | |
promises-bluebird.js 596 103.95 | |
promises-bluebird-generator.js 612 109.46 | |
async-es2017-native.js 1102 226.88 | |
async-es2017-util.promisify.js 1238 223.54 | |
promises-es2015-native.js 1298 228.75 | |
promises-es2015-util.promisify.js 1484 218.79 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Doxbee sequential | |
benchmarking ./doxbee-sequential/async-bluebird.js | |
{"time":382,"mem":50.33984375,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/async-es2017-native.js | |
{"time":322,"mem":57.6015625,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/async-es2017-util.promisify.js | |
{"time":398,"mem":59.3203125,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/callbacks-baseline.js | |
{"time":183,"mem":26.16796875,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/promises-bluebird-generator.js | |
{"time":295,"mem":37.49609375,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/promises-bluebird.js | |
{"time":364,"mem":50.875,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/promises-es2015-native.js | |
{"time":431,"mem":68.515625,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/promises-es2015-util.promisify.js | |
{"time":427,"mem":69.87109375,"errors":0,"lastErr":null} | |
results for 10000 parallel executions, 1 ms per I/O op | |
file time(ms) memory(MB) | |
callbacks-baseline.js 183 26.17 | |
promises-bluebird-generator.js 295 37.50 | |
async-es2017-native.js 322 57.60 | |
promises-bluebird.js 364 50.88 | |
async-bluebird.js 382 50.34 | |
async-es2017-util.promisify.js 398 59.32 | |
promises-es2015-util.promisify.js 427 69.87 | |
Madeup parallel | |
benchmarking ./madeup-parallel/async-bluebird.js | |
{"time":655,"mem":104.79296875,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/async-es2017-native.js | |
{"time":1326,"mem":211.83203125,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/async-es2017-util.promisify.js | |
{"time":1486,"mem":207.19140625,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/callbacks-baseline.js | |
{"time":387,"mem":70.4609375,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/promises-bluebird-generator.js | |
{"time":705,"mem":94.62890625,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/promises-bluebird.js | |
{"time":909,"mem":94.94140625,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/promises-es2015-native.js | |
{"time":1593,"mem":214.46875,"errors":0,"lastErr":null} | |
benchmarking ./madeup-parallel/promises-es2015-util.promisify.js | |
{"time":1507,"mem":203.484375,"errors":0,"lastErr":null} | |
results for 10000 parallel executions, 1 ms per I/O op | |
file time(ms) memory(MB) | |
callbacks-baseline.js 387 70.46 | |
async-bluebird.js 655 104.79 | |
promises-bluebird-generator.js 705 94.63 | |
promises-bluebird.js 909 94.94 | |
async-es2017-native.js 1326 211.83 | |
async-es2017-util.promisify.js 1486 207.19 | |
promises-es2015-util.promisify.js 1507 203.48 | |
promises-es2015-native.js 1593 214.47 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment