petkaantonov / bluebird

:bird: :zap: Bluebird is a full featured promise library with unmatched performance.
http://bluebirdjs.com
MIT License
20.45k stars 2.33k forks source link

Long stack traces performance regression in Node.js v7.x #1337

Closed mrtbld closed 7 years ago

mrtbld commented 7 years ago

System info Bluebird version: 3.4.7 Node.js version: 7.5.0 V8 version: 5.4.500.48 Plaform: Linux 4.8.13-100.fc23.x86_64 x64 CPU: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz × 8

Issue description

Bluebird with long stack traces is 15× slower in v7.5.0 than in v6.9.5 for doxbee sequential benchmark (on my PC, YMMV). It also impacts the Node app I work on (real-world usage) to the point I had to deactivate long stack traces in dev.

It seems to be caused by a performance regression of Error.captureStackTrace in Node v7.x.

This issue's purpose is mainly documentation, because I don't see what could be done bluebird-wise to mitigate this.

Summary:

(doxbee-sequential/promises-bluebird.js)
v6.9.5                    209 ms
v6.9.5 longStackTraces  1,181 ms
v7.5.0                    220 ms
v7.5.0 longStackTraces 17,715 ms

Full brenchmark outputs:

$ node --version
v6.9.5
$ BLUEBIRD_LONG_STACK_TRACES=0 ./bench doxbee
Doxbee sequential

results for 10000 parallel executions, 1 ms per I/O op

file                                       time(ms)  memory(MB)
callbacks-baseline.js                            98       25.50
callbacks-suguru03-neo-async-waterfall.js       133       35.05
promises-bluebird-generator.js                  188       29.34
promises-bluebird.js                            209       46.69
promises-then-promise.js                        291       58.82
promises-cujojs-when.js                         296       59.15
promises-lvivski-davy.js                        368       81.93
promises-tildeio-rsvp.js                        377       88.17
callbacks-caolan-async-waterfall.js             492       98.02
promises-dfilatov-vow.js                        555      126.55
promises-calvinmetcalf-lie.js                   636      121.77
generators-tj-co.js                             891      120.35
promises-ecmascript6-native.js                  908      185.28
promises-obvious-kew.js                         930      217.68
promises-medikoo-deferred.js                   1338      162.48
observables-Reactive-Extensions-RxJS.js        1654      218.58
streamline-generators.js                       1658      177.04
streamline-callbacks.js                        2675      248.75
promises-kriskowal-q.js                        8340      852.43
observables-baconjs-bacon.js.js               16604      808.29
observables-pozadi-kefir.js                   26766      155.57
observables-caolan-highland.js                88333      464.53

Platform info:
Linux 4.8.13-100.fc23.x86_64 x64
Node.JS 6.9.5
V8 5.1.281.89
Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz × 8
$ node --version
v6.9.5
$ BLUEBIRD_LONG_STACK_TRACES=1 ./bench doxbee
Doxbee sequential

results for 10000 parallel executions, 1 ms per I/O op

file                                       time(ms)  memory(MB)
callbacks-baseline.js                            97       25.24
callbacks-suguru03-neo-async-waterfall.js       134       34.54
promises-cujojs-when.js                         288       60.29
promises-then-promise.js                        302       63.43
promises-tildeio-rsvp.js                        375       85.88
promises-lvivski-davy.js                        377       79.23
callbacks-caolan-async-waterfall.js             492       98.34
promises-dfilatov-vow.js                        543      126.79
promises-calvinmetcalf-lie.js                   643      122.87
promises-bluebird-generator.js                  822       95.95
generators-tj-co.js                             876      133.88
promises-ecmascript6-native.js                  914      185.60
promises-obvious-kew.js                         924      218.56
promises-bluebird.js                           1181      145.76
promises-medikoo-deferred.js                   1319      157.96
streamline-generators.js                       1656      176.08
observables-Reactive-Extensions-RxJS.js        1677      218.92
streamline-callbacks.js                        2548      248.34
promises-kriskowal-q.js                        8105      420.52
observables-baconjs-bacon.js.js               16351      810.34
observables-pozadi-kefir.js                   26757      156.23
observables-caolan-highland.js                93344      476.82

Platform info:
Linux 4.8.13-100.fc23.x86_64 x64
Node.JS 6.9.5
V8 5.1.281.89
Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz × 8
$ node --version
v7.5.0
$ BLUEBIRD_LONG_STACK_TRACES=0 ./bench doxbee
Doxbee sequential

results for 10000 parallel executions, 1 ms per I/O op

file                                       time(ms)  memory(MB)
callbacks-baseline.js                           104       24.41
callbacks-suguru03-neo-async-waterfall.js       165       39.30
promises-bluebird-generator.js                  201       39.36
promises-bluebird.js                            220       47.20
promises-cujojs-when.js                         280       59.69
promises-then-promise.js                        281       65.76
promises-lvivski-davy.js                        320       88.66
promises-tildeio-rsvp.js                        356       95.12
callbacks-caolan-async-waterfall.js             495      107.22
promises-dfilatov-vow.js                        592      128.22
promises-calvinmetcalf-lie.js                   649      166.70
generators-tj-co.js                             685      127.92
promises-ecmascript6-native.js                  769      142.58
promises-obvious-kew.js                         781      110.95
promises-medikoo-deferred.js                   1030      157.84
observables-pozadi-kefir.js                    1174      175.68
streamline-generators.js                       1222      153.83
observables-Reactive-Extensions-RxJS.js        1398      256.70
streamline-callbacks.js                        1805      198.08
observables-caolan-highland.js                 4826      502.64
promises-kriskowal-q.js                        5664      447.87
observables-baconjs-bacon.js.js               17850      882.49

Platform info:
Linux 4.8.13-100.fc23.x86_64 x64
Node.JS 7.5.0
V8 5.4.500.48
Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz × 8
$ node --version
v7.5.0
$ BLUEBIRD_LONG_STACK_TRACES=1 ./bench doxbee
Doxbee sequential

results for 10000 parallel executions, 1 ms per I/O op

file                                       time(ms)  memory(MB)
callbacks-baseline.js                           107       25.57
callbacks-suguru03-neo-async-waterfall.js       158       38.99
promises-cujojs-when.js                         269       60.96
promises-then-promise.js                        276       65.06
promises-lvivski-davy.js                        315       87.96
promises-tildeio-rsvp.js                        351       86.25
callbacks-caolan-async-waterfall.js             490      107.13
promises-dfilatov-vow.js                        505      134.45
promises-calvinmetcalf-lie.js                   632      167.58
generators-tj-co.js                             658      127.11
promises-ecmascript6-native.js                  746      146.86
promises-obvious-kew.js                         806      129.78
promises-medikoo-deferred.js                   1033      157.85
observables-pozadi-kefir.js                    1136      176.18
streamline-generators.js                       1192      153.68
observables-Reactive-Extensions-RxJS.js        1384      255.42
streamline-callbacks.js                        1824      199.92
observables-caolan-highland.js                 4870      502.74
promises-kriskowal-q.js                        5703      449.86
promises-bluebird-generator.js                 9132      561.05
promises-bluebird.js                          17715      834.00
observables-baconjs-bacon.js.js               17731      877.40

Platform info:
Linux 4.8.13-100.fc23.x86_64 x64
Node.JS 7.5.0
V8 5.4.500.48
Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz × 8
spion commented 7 years ago

Relevant issue to watch: https://bugs.chromium.org/p/v8/issues/detail?id=5962

stefanpenner commented 7 years ago

the v8 issue has been addressed, I suspect this issue can be closed.