Skip to content

lib: improve async_context_frame structure

This is a followup to #48528 to deal with some unresolved feedback and to try a prototype-swap improvement to speed up AsyncResource performance a bit. Here's the benchmark numbers:

                                                                                          confidence improvement accuracy (*)   (**)  (***)
async_hooks/async-local-storage-getstore-nested-resources.js n=500000 resourceCount=10          ***      0.65 %       ±0.20% ±0.27% ±0.34%
async_hooks/async-local-storage-getstore-nested-resources.js n=500000 resourceCount=100                  0.05 %       ±0.24% ±0.32% ±0.40%
async_hooks/async-local-storage-getstore-nested-resources.js n=500000 resourceCount=1000        ***      1.07 %       ±0.27% ±0.35% ±0.45%
async_hooks/async-local-storage-getstore-nested-run.js n=10000 storageCount=1                     *     -0.81 %       ±0.66% ±0.87% ±1.11%
async_hooks/async-local-storage-getstore-nested-run.js n=10000 storageCount=10                          -0.45 %       ±0.65% ±0.85% ±1.09%
async_hooks/async-local-storage-getstore-nested-run.js n=10000 storageCount=100                          0.46 %       ±0.67% ±0.88% ±1.13%
async_hooks/async-local-storage-propagate-asyncresource.js n=1000 storageCount=0                ***      4.35 %       ±0.68% ±0.90% ±1.14%
async_hooks/async-local-storage-propagate-asyncresource.js n=1000 storageCount=1                ***      5.27 %       ±0.58% ±0.77% ±0.98%
async_hooks/async-local-storage-propagate-asyncresource.js n=1000 storageCount=10               ***      1.28 %       ±0.63% ±0.83% ±1.06%
async_hooks/async-local-storage-propagate-asyncresource.js n=1000 storageCount=100               **      0.37 %       ±0.23% ±0.30% ±0.38%
async_hooks/async-local-storage-propagate-promise.js n=100000 storageCount=0                    ***      0.59 %       ±0.34% ±0.45% ±0.57%
async_hooks/async-local-storage-propagate-promise.js n=100000 storageCount=1                    ***      0.27 %       ±0.15% ±0.20% ±0.25%
async_hooks/async-local-storage-propagate-promise.js n=100000 storageCount=10                            0.11 %       ±0.12% ±0.16% ±0.20%
async_hooks/async-local-storage-propagate-promise.js n=100000 storageCount=100                          -0.17 %       ±0.19% ±0.26% ±0.33%
async_hooks/async-local-storage-run.js n=10000000                                                        0.29 %       ±0.39% ±0.51% ±0.66%

Be aware that when doing many comparisons the risk of a false-positive result increases.
In this case, there are 15 comparisons, you can thus expect the following amount of false-positive results:
  0.75 false positives, when considering a   5% risk acceptance (*, **, ***),
  0.15 false positives, when considering a   1% risk acceptance (**, ***),
  0.01 false positives, when considering a 0.1% risk acceptance (***)

Merge request reports

Loading