{{ message }}
Commit 28cb7e7
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: #31605
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>1 parent 3bf21b0 commit 28cb7e7
6 files changed
Lines changed: 61 additions & 24 deletions
File tree
- lib/internal/per_context
- src
- api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
| 436 | + | |
436 | 437 | | |
437 | 438 | | |
438 | 439 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | | - | |
417 | 416 | | |
418 | 417 | | |
419 | 418 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
188 | 187 | | |
189 | 188 | | |
190 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
191 | 204 | | |
192 | 205 | | |
193 | 206 | | |
| |||
498 | 511 | | |
499 | 512 | | |
500 | 513 | | |
| 514 | + | |
501 | 515 | | |
502 | 516 | | |
503 | 517 | | |
504 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
505 | 522 | | |
506 | 523 | | |
507 | 524 | | |
508 | 525 | | |
509 | 526 | | |
510 | 527 | | |
511 | 528 | | |
512 | | - | |
| 529 | + | |
| 530 | + | |
513 | 531 | | |
514 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
515 | 539 | | |
516 | 540 | | |
517 | 541 | | |
| |||
559 | 583 | | |
560 | 584 | | |
561 | 585 | | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
562 | 591 | | |
563 | 592 | | |
564 | 593 | | |
| |||
651 | 680 | | |
652 | 681 | | |
653 | 682 | | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
| 683 | + | |
| 684 | + | |
664 | 685 | | |
665 | 686 | | |
666 | 687 | | |
| |||
929 | 950 | | |
930 | 951 | | |
931 | 952 | | |
| 953 | + | |
932 | 954 | | |
933 | 955 | | |
934 | 956 | | |
| |||
938 | 960 | | |
939 | 961 | | |
940 | 962 | | |
941 | | - | |
942 | | - | |
943 | 963 | | |
944 | 964 | | |
945 | 965 | | |
| |||
950 | 970 | | |
951 | 971 | | |
952 | 972 | | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | | - | |
957 | | - | |
958 | | - | |
959 | | - | |
960 | 973 | | |
961 | 974 | | |
962 | 975 | | |
| |||
975 | 988 | | |
976 | 989 | | |
977 | 990 | | |
| 991 | + | |
978 | 992 | | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
979 | 998 | | |
980 | 999 | | |
981 | 1000 | | |
| |||

0 commit comments