diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-02-01 17:16:23 +0100 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2020-02-07 11:01:59 -1000 |
commit | a555be2e45b283a201de21350c0115680a7d4e7c (patch) | |
tree | c494be3c06a27acfc77b11ca4a0bb873fb331142 /node.gyp | |
parent | e2a3a87060af4c48b2551d20dfede33183b1931d (diff) | |
download | node-new-a555be2e45b283a201de21350c0115680a7d4e7c.tar.gz |
worker: improve MessagePort performance
Use a JS function as the single entry point for emitting `.onmessage()`
calls, avoiding the overhead of manually constructing each message
event object in C++.
confidence improvement accuracy (*) (**) (***)
worker/echo.js n=100000 sendsPerBroadcast=1 payload='object' workers=1 *** 16.34 % ±1.16% ±1.54% ±1.99%
worker/echo.js n=100000 sendsPerBroadcast=1 payload='string' workers=1 *** 24.41 % ±1.50% ±1.99% ±2.58%
worker/echo.js n=100000 sendsPerBroadcast=10 payload='object' workers=1 *** 26.66 % ±1.54% ±2.05% ±2.65%
worker/echo.js n=100000 sendsPerBroadcast=10 payload='string' workers=1 *** 32.72 % ±1.60% ±2.11% ±2.73%
worker/messageport.js n=1000000 payload='object' *** 40.28 % ±1.48% ±1.95% ±2.52%
worker/messageport.js n=1000000 payload='string' *** 76.95 % ±2.19% ±2.90% ±3.75%
Also fix handling exceptions returned from `MessagePort::New`.
PR-URL: https://github.com/nodejs/node/pull/31605
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'node.gyp')
-rw-r--r-- | node.gyp | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -37,6 +37,7 @@ 'lib/internal/bootstrap/switches/is_not_main_thread.js', 'lib/internal/per_context/primordials.js', 'lib/internal/per_context/domexception.js', + 'lib/internal/per_context/messageport.js', 'lib/async_hooks.js', 'lib/assert.js', 'lib/buffer.js', |