Sitelet https://github.com/nodejs/node/pull/65519
Skip to content

lib: optimize async context frame activation - #65519

Open
pimterry wants to merge 1 commit into
nodejs:mainfrom
pimterry:optimize-async-context-frame
Open

lib: optimize async context frame activation#65519
pimterry wants to merge 1 commit into
nodejs:mainfrom
pimterry:optimize-async-context-frame

Conversation

@pimterry

Copy link
Copy Markdown
Member

Async context frame is activated lazily. The current implementation did this by waiting for the first call to checkEnabled, and then changing the prototype of AsyncContextFrame to ActiveAsyncContextFrame if enabled. This overrides the current, set, exchange and disable methods to the active versions.

Swapping the prototype like this makes the replaced methods slow. My best understanding is that V8 caches the lookup for the methods on their prototype when they're used initially, and when the prototype is changed (lazily later, via various triggers but notably including socket timeout setup for any server) those caches are lost, and never recover, making every use of those methods about 8x slower. This relates to AsyncLocalStorage, but it doesn't require actually using it - it applies to basically everybody.

That's bad because we call these methods a lot: every tick, immediate & timer. Assigning the methods instead of modifying the prototype avoids this slowdown.

I found this exploring HTTP/1 performance: this tiny change immediately boosts HTTP perf for the http/simple benchmark by about 5%, with no user-visible changes, by dropping overhead on all the ticks involved. I'll do a benchmark run to confirm impact in a minute.

It should also improve performance in plenty of other places too though, really any code heavily using timers or nextTick: as an extreme case, I see pure timer benchmarks like timers-timeout-nexttick jump up to 70% with this change. Micro-optimization, but in very hot & widely used code.

No downside AFAICT. Actual change is very simple (replace ObjectSetPrototypeOf with 4x method assignments) but I've simplified the surrounding code en route (dropped the ActiveAsyncContextFrame class completely, since it's now just loose methods) and moved checkEnabled to the end of the file, which means we can drop the eslint-disable for use-before-define.

Signed-off-by: Tim Perry <pimterry@gmail.com>
@pimterry
pimterry requested a review from Qard August 24, 2026 17:22
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Aug 24, 2026
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.16%. Comparing base (f509cf1) to head (73ad7b6).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65519      +/-   ##
==========================================
+ Coverage   90.14%   90.16%   +0.01%     
==========================================
  Files         751      751              
  Lines      253585   253579       -6     
  Branches    47772    47786      +14     
==========================================
+ Hits       228596   228637      +41     
+ Misses      16228    16200      -28     
+ Partials     8761     8742      -19     
Files with missing lines Coverage Δ
lib/internal/async_context_frame.js 100.00% <100.00%> (ø)

... and 28 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pimterry

Copy link
Copy Markdown
Member Author

I'll do a benchmark run to confirm impact in a minute.

https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1890/, benchmarking the HTTP tests specifically. Results:

Details
                                                                                                  confidence improvement accuracy (*)    (**)   (***)
http/bench-parser-fragmented.js n=100000 frags=2 len=16                                                           0.24 %       ±0.76%  ±1.02%  ±1.32%
http/bench-parser-fragmented.js n=100000 frags=2 len=8                                                           -0.33 %       ±1.06%  ±1.41%  ±1.83%
http/bench-parser-fragmented.js n=100000 frags=4 len=16                                                           0.45 %       ±1.04%  ±1.39%  ±1.81%
http/bench-parser-fragmented.js n=100000 frags=4 len=8                                                           -0.63 %       ±0.75%  ±1.00%  ±1.31%
http/bench-parser-fragmented.js n=100000 frags=8 len=16                                                   **     -1.07 %       ±0.76%  ±1.01%  ±1.32%
http/bench-parser-fragmented.js n=100000 frags=8 len=8                                                           -0.72 %       ±0.78%  ±1.03%  ±1.34%
http/bench-parser.js n=100000 len=16                                                                      **      1.48 %       ±0.97%  ±1.29%  ±1.68%
http/bench-parser.js n=100000 len=32                                                                              0.41 %       ±0.65%  ±0.86%  ±1.12%
http/bench-parser.js n=100000 len=4                                                                               0.93 %       ±1.09%  ±1.46%  ±1.91%
http/bench-parser.js n=100000 len=8                                                                              -0.49 %       ±1.06%  ±1.41%  ±1.84%
http/check_invalid_header_char.js n=1000000 input=''                                                              2.18 %       ±4.55%  ±6.06%  ±7.89%
http/check_invalid_header_char.js n=1000000 input='\t\t\t\t\t\t\t\t\t\tFoo bar baz'                               0.16 %       ±1.66%  ±2.21%  ±2.87%
http/check_invalid_header_char.js n=1000000 input='\x7F'                                                         -2.57 %       ±3.70%  ±4.93%  ±6.41%
http/check_invalid_header_char.js n=1000000 input='1'                                                            -0.95 %       ±4.27%  ±5.68%  ±7.41%
http/check_invalid_header_char.js n=1000000 input='20091'                                                         0.75 %       ±3.25%  ±4.32%  ±5.62%
http/check_invalid_header_char.js n=1000000 input='close'                                                         2.52 %       ±2.96%  ±3.94%  ±5.14%
http/check_invalid_header_char.js n=1000000 input='en-US'                                                        -2.23 %       ±3.23%  ±4.30%  ±5.59%
http/check_invalid_header_char.js n=1000000 input='foo\nbar'                                                      2.09 %       ±2.80%  ±3.72%  ±4.85%
http/check_invalid_header_char.js n=1000000 input='group_acmeair'                                                 1.06 %       ±1.85%  ±2.46%  ±3.20%
http/check_invalid_header_char.js n=1000000 input='gzip'                                                         -2.10 %       ±3.08%  ±4.10%  ±5.34%
http/check_invalid_header_char.js n=1000000 input='keep-alive'                                                   -0.33 %       ±2.31%  ±3.07%  ±4.00%
http/check_invalid_header_char.js n=1000000 input='LONG_AND_INVALID'                                              0.04 %       ±1.10%  ±1.46%  ±1.90%
http/check_invalid_header_char.js n=1000000 input='private'                                                      -1.09 %       ±2.90%  ±3.85%  ±5.02%
http/check_invalid_header_char.js n=1000000 input='SAMEORIGIN'                                                    0.41 %       ±2.82%  ±3.76%  ±4.89%
http/check_invalid_header_char.js n=1000000 input='Sat, 07 May 2016 16:54:48 GMT'                                 0.52 %       ±1.64%  ±2.18%  ±2.84%
http/check_invalid_header_char.js n=1000000 input='text/html; charset=utf-8'                                     -0.48 %       ±1.74%  ±2.32%  ±3.03%
http/check_invalid_header_char.js n=1000000 input='text/plain'                                                    2.24 %       ±2.30%  ±3.07%  ±3.99%
http/check_invalid_header_char.js n=1000000 input='中文呢'                                                          -0.86 %       ±2.50%  ±3.32%  ±4.32%
http/check_is_http_token.js n=1000000 key=':'                                                                    -0.17 %       ±0.90%  ±1.20%  ±1.56%
http/check_is_http_token.js n=1000000 key=':alternate-protocol'                                                   1.52 %       ±3.65%  ±4.86%  ±6.33%
http/check_is_http_token.js n=1000000 key='((((())))'                                                     **      0.93 %       ±0.57%  ±0.77%  ±1.00%
http/check_is_http_token.js n=1000000 key='@@'                                                                    0.47 %       ±0.51%  ±0.68%  ±0.88%
http/check_is_http_token.js n=1000000 key='Accept-Ranges'                                                         0.56 %       ±2.43%  ±3.23%  ±4.20%
http/check_is_http_token.js n=1000000 key='alt-svc'                                                              -0.71 %       ±3.16%  ±4.21%  ±5.48%
http/check_is_http_token.js n=1000000 key='alternate-protocol:'                                            *      2.11 %       ±2.10%  ±2.79%  ±3.63%
http/check_is_http_token.js n=1000000 key='alternate-protocol'                                                   -1.84 %       ±2.42%  ±3.22%  ±4.19%
http/check_is_http_token.js n=1000000 key='Cache-Control'                                                        -1.51 %       ±2.00%  ±2.66%  ±3.46%
http/check_is_http_token.js n=1000000 key='Connection'                                                            1.77 %       ±2.13%  ±2.84%  ±3.70%
http/check_is_http_token.js n=1000000 key='Content-Encoding'                                                     -0.62 %       ±2.47%  ±3.29%  ±4.28%
http/check_is_http_token.js n=1000000 key='content-length'                                                 *     -2.49 %       ±2.43%  ±3.24%  ±4.23%
http/check_is_http_token.js n=1000000 key='Content-Location'                                                     -1.14 %       ±2.14%  ±2.86%  ±3.74%
http/check_is_http_token.js n=1000000 key='content-type'                                                         -0.66 %       ±2.26%  ±3.01%  ±3.92%
http/check_is_http_token.js n=1000000 key='Content-Type'                                                          1.17 %       ±2.91%  ±3.87%  ±5.05%
http/check_is_http_token.js n=1000000 key='date'                                                                 -0.27 %       ±3.46%  ±4.61%  ±6.02%
http/check_is_http_token.js n=1000000 key='ETag'                                                                 -1.48 %       ±1.91%  ±2.55%  ±3.33%
http/check_is_http_token.js n=1000000 key='Expires'                                                              -1.74 %       ±3.20%  ±4.26%  ±5.56%
http/check_is_http_token.js n=1000000 key='Keep-Alive'                                                           -0.98 %       ±2.21%  ±2.95%  ±3.83%
http/check_is_http_token.js n=1000000 key='Last-Modified'                                                         0.56 %       ±2.30%  ±3.07%  ±4.00%
http/check_is_http_token.js n=1000000 key='location'                                                              0.45 %       ±2.14%  ±2.84%  ±3.70%
http/check_is_http_token.js n=1000000 key='server'                                                               -0.90 %       ±2.08%  ±2.77%  ±3.60%
http/check_is_http_token.js n=1000000 key='Server'                                                                0.88 %       ±1.93%  ±2.57%  ±3.36%
http/check_is_http_token.js n=1000000 key='status'                                                               -0.93 %       ±2.71%  ±3.60%  ±4.68%
http/check_is_http_token.js n=1000000 key='TCN'                                                                   0.45 %       ±2.14%  ±2.85%  ±3.71%
http/check_is_http_token.js n=1000000 key='Transfer-Encoding'                                                    -0.57 %       ±2.88%  ±3.83%  ±4.99%
http/check_is_http_token.js n=1000000 key='Vary'                                                                 -2.16 %       ±3.02%  ±4.03%  ±5.26%
http/check_is_http_token.js n=1000000 key='version'                                                              -1.44 %       ±3.63%  ±4.83%  ±6.30%
http/check_is_http_token.js n=1000000 key='x-frame-options'                                                       1.27 %       ±2.26%  ±3.01%  ±3.92%
http/check_is_http_token.js n=1000000 key='x-xss-protection'                                                     -1.39 %       ±2.43%  ±3.23%  ±4.21%
http/check_is_http_token.js n=1000000 key='中文呢'                                                                  -0.63 %       ±0.73%  ±0.98%  ±1.29%
http/chunked.js duration=5 c=100 len=1 n=1 benchmarker='wrk'                                             ***      2.66 %       ±0.82%  ±1.12%  ±1.49%
http/chunked.js duration=5 c=100 len=1 n=16 benchmarker='wrk'                                                     0.55 %       ±1.13%  ±1.54%  ±2.07%
http/chunked.js duration=5 c=100 len=1 n=4 benchmarker='wrk'                                                      0.78 %       ±2.24%  ±3.04%  ±4.07%
http/chunked.js duration=5 c=100 len=1 n=8 benchmarker='wrk'                                                      0.78 %       ±1.50%  ±2.05%  ±2.79%
http/chunked.js duration=5 c=100 len=256 n=1 benchmarker='wrk'                                            **      1.95 %       ±1.38%  ±1.88%  ±2.52%
http/chunked.js duration=5 c=100 len=256 n=16 benchmarker='wrk'                                            *      1.39 %       ±1.35%  ±1.84%  ±2.47%
http/chunked.js duration=5 c=100 len=256 n=4 benchmarker='wrk'                                                   -0.16 %       ±2.48%  ±3.40%  ±4.63%
http/chunked.js duration=5 c=100 len=256 n=8 benchmarker='wrk'                                                   -0.02 %       ±1.71%  ±2.33%  ±3.16%
http/chunked.js duration=5 c=100 len=64 n=1 benchmarker='wrk'                                            ***      1.73 %       ±0.95%  ±1.29%  ±1.73%
http/chunked.js duration=5 c=100 len=64 n=16 benchmarker='wrk'                                                    0.09 %       ±1.14%  ±1.54%  ±2.07%
http/chunked.js duration=5 c=100 len=64 n=4 benchmarker='wrk'                                                     2.03 %       ±2.93%  ±4.02%  ±5.50%
http/chunked.js duration=5 c=100 len=64 n=8 benchmarker='wrk'                                                    -0.53 %       ±1.07%  ±1.47%  ±2.00%
http/end-vs-write-end.js duration=5 method='end' c=100 len=1048576 type='asc' benchmarker='wrk'                   0.14 %       ±0.48%  ±0.64%  ±0.84%
http/end-vs-write-end.js duration=5 method='end' c=100 len=1048576 type='buf' benchmarker='wrk'           **      0.57 %       ±0.38%  ±0.51%  ±0.66%
http/end-vs-write-end.js duration=5 method='end' c=100 len=1048576 type='utf' benchmarker='wrk'            *      0.45 %       ±0.39%  ±0.52%  ±0.68%
http/end-vs-write-end.js duration=5 method='end' c=100 len=131072 type='asc' benchmarker='wrk'           ***      1.62 %       ±0.70%  ±0.93%  ±1.22%
http/end-vs-write-end.js duration=5 method='end' c=100 len=131072 type='buf' benchmarker='wrk'           ***      2.55 %       ±0.54%  ±0.73%  ±0.95%
http/end-vs-write-end.js duration=5 method='end' c=100 len=131072 type='utf' benchmarker='wrk'           ***      1.76 %       ±0.44%  ±0.59%  ±0.77%
http/end-vs-write-end.js duration=5 method='end' c=100 len=262144 type='asc' benchmarker='wrk'           ***      1.03 %       ±0.54%  ±0.72%  ±0.95%
http/end-vs-write-end.js duration=5 method='end' c=100 len=262144 type='buf' benchmarker='wrk'           ***      1.60 %       ±0.53%  ±0.71%  ±0.93%
http/end-vs-write-end.js duration=5 method='end' c=100 len=262144 type='utf' benchmarker='wrk'           ***      0.75 %       ±0.34%  ±0.45%  ±0.59%
http/end-vs-write-end.js duration=5 method='end' c=100 len=65536 type='asc' benchmarker='wrk'            ***      2.78 %       ±0.84%  ±1.12%  ±1.47%
http/end-vs-write-end.js duration=5 method='end' c=100 len=65536 type='buf' benchmarker='wrk'            ***      4.49 %       ±0.62%  ±0.83%  ±1.08%
http/end-vs-write-end.js duration=5 method='end' c=100 len=65536 type='utf' benchmarker='wrk'            ***      2.30 %       ±0.44%  ±0.59%  ±0.78%
http/end-vs-write-end.js duration=5 method='write' c=100 len=1048576 type='asc' benchmarker='wrk'                 0.25 %       ±0.57%  ±0.76%  ±1.00%
http/end-vs-write-end.js duration=5 method='write' c=100 len=1048576 type='buf' benchmarker='wrk'          *      0.59 %       ±0.57%  ±0.76%  ±1.00%
http/end-vs-write-end.js duration=5 method='write' c=100 len=1048576 type='utf' benchmarker='wrk'         **      0.48 %       ±0.35%  ±0.46%  ±0.61%
http/end-vs-write-end.js duration=5 method='write' c=100 len=131072 type='asc' benchmarker='wrk'         ***      1.95 %       ±1.03%  ±1.37%  ±1.79%
http/end-vs-write-end.js duration=5 method='write' c=100 len=131072 type='buf' benchmarker='wrk'         ***      2.75 %       ±0.60%  ±0.80%  ±1.04%
http/end-vs-write-end.js duration=5 method='write' c=100 len=131072 type='utf' benchmarker='wrk'           *      1.15 %       ±1.02%  ±1.36%  ±1.77%
http/end-vs-write-end.js duration=5 method='write' c=100 len=262144 type='asc' benchmarker='wrk'          **      1.33 %       ±0.83%  ±1.10%  ±1.44%
http/end-vs-write-end.js duration=5 method='write' c=100 len=262144 type='buf' benchmarker='wrk'         ***      1.37 %       ±0.59%  ±0.78%  ±1.03%
http/end-vs-write-end.js duration=5 method='write' c=100 len=262144 type='utf' benchmarker='wrk'         ***      1.60 %       ±0.50%  ±0.67%  ±0.87%
http/end-vs-write-end.js duration=5 method='write' c=100 len=65536 type='asc' benchmarker='wrk'          ***      3.50 %       ±0.89%  ±1.18%  ±1.55%
http/end-vs-write-end.js duration=5 method='write' c=100 len=65536 type='buf' benchmarker='wrk'          ***      4.29 %       ±0.96%  ±1.28%  ±1.68%
http/end-vs-write-end.js duration=5 method='write' c=100 len=65536 type='utf' benchmarker='wrk'          ***      2.84 %       ±0.56%  ±0.75%  ±0.99%
http/headers.js group='fewHeaders' duration=5 len=1 n=10 benchmarker='wrk'                               ***      4.86 %       ±0.69%  ±0.92%  ±1.20%
http/headers.js group='fewHeaders' duration=5 len=5 n=10 benchmarker='wrk'                               ***      5.45 %       ±0.60%  ±0.79%  ±1.03%
http/headers.js group='manyHeaders' duration=5 len=1 n=600 benchmarker='wrk'                                      0.35 %       ±0.72%  ±0.96%  ±1.24%
http/headers.js group='manyHeaders' duration=5 len=100 n=600 benchmarker='wrk'                                    0.61 %       ±0.98%  ±1.31%  ±1.70%
http/headers.js group='mediumHeaders' duration=5 len=1 n=50 benchmarker='wrk'                            ***      3.30 %       ±0.52%  ±0.70%  ±0.91%
http/headers.js group='mediumHeaders' duration=5 len=10 n=50 benchmarker='wrk'                           ***      3.68 %       ±0.47%  ±0.63%  ±0.82%
http/http_server_for_chunky_client.js type='send' n=2000 len=1                                                   -0.20 %       ±0.53%  ±0.70%  ±0.91%
http/http_server_for_chunky_client.js type='send' n=2000 len=128                                                  0.13 %       ±0.58%  ±0.78%  ±1.02%
http/http_server_for_chunky_client.js type='send' n=2000 len=16                                                  -0.42 %       ±0.68%  ±0.91%  ±1.18%
http/http_server_for_chunky_client.js type='send' n=2000 len=32                                                   0.05 %       ±0.62%  ±0.82%  ±1.07%
http/http_server_for_chunky_client.js type='send' n=2000 len=4                                                   -0.18 %       ±0.67%  ±0.89%  ±1.16%
http/http_server_for_chunky_client.js type='send' n=2000 len=64                                                   0.09 %       ±0.65%  ±0.87%  ±1.13%
http/http_server_for_chunky_client.js type='send' n=2000 len=8                                                   -0.23 %       ±0.52%  ±0.70%  ±0.91%
http/http_server_for_chunky_client.js type='send' n=5 len=1                                                       2.07 %       ±3.31%  ±4.41%  ±5.74%
http/http_server_for_chunky_client.js type='send' n=5 len=128                                                    -3.57 %      ±13.38% ±17.80% ±23.16%
http/http_server_for_chunky_client.js type='send' n=5 len=16                                                     -6.24 %       ±8.15% ±10.93% ±14.41%
http/http_server_for_chunky_client.js type='send' n=5 len=32                                                     -1.78 %       ±4.55%  ±6.05%  ±7.88%
http/http_server_for_chunky_client.js type='send' n=5 len=4                                                       3.77 %       ±8.17% ±10.90% ±14.22%
http/http_server_for_chunky_client.js type='send' n=5 len=64                                                      0.68 %      ±15.25% ±20.30% ±26.42%
http/http_server_for_chunky_client.js type='send' n=5 len=8                                                      -0.45 %       ±4.43%  ±5.89%  ±7.67%
http/http_server_for_chunky_client.js type='send' n=50 len=1                                              **     -3.24 %       ±2.05%  ±2.73%  ±3.55%
http/http_server_for_chunky_client.js type='send' n=50 len=128                                                    0.54 %       ±3.63%  ±4.83%  ±6.28%
http/http_server_for_chunky_client.js type='send' n=50 len=16                                                    -0.54 %       ±2.51%  ±3.34%  ±4.35%
http/http_server_for_chunky_client.js type='send' n=50 len=32                                                    -0.28 %       ±1.97%  ±2.62%  ±3.41%
http/http_server_for_chunky_client.js type='send' n=50 len=4                                                      1.39 %       ±2.62%  ±3.49%  ±4.54%
http/http_server_for_chunky_client.js type='send' n=50 len=64                                                     0.64 %       ±3.01%  ±4.01%  ±5.22%
http/http_server_for_chunky_client.js type='send' n=50 len=8                                                      1.21 %       ±2.76%  ±3.67%  ±4.79%
http/http_server_for_chunky_client.js type='send' n=500 len=1                                                    -0.41 %       ±0.90%  ±1.19%  ±1.55%
http/http_server_for_chunky_client.js type='send' n=500 len=128                                                  -0.04 %       ±0.71%  ±0.95%  ±1.24%
http/http_server_for_chunky_client.js type='send' n=500 len=16                                                   -0.26 %       ±0.69%  ±0.91%  ±1.19%
http/http_server_for_chunky_client.js type='send' n=500 len=32                                                    0.42 %       ±0.62%  ±0.82%  ±1.07%
http/http_server_for_chunky_client.js type='send' n=500 len=4                                                    -0.21 %       ±0.85%  ±1.14%  ±1.49%
http/http_server_for_chunky_client.js type='send' n=500 len=64                                                   -0.06 %       ±0.73%  ±0.97%  ±1.26%
http/http_server_for_chunky_client.js type='send' n=500 len=8                                                    -0.22 %       ±0.72%  ±0.95%  ±1.24%
http/incoming_headers.js duration=5 w=0 headers=20 connections=50 benchmarker='wrk'                      ***      5.80 %       ±0.87%  ±1.15%  ±1.50%
http/incoming_headers.js duration=5 w=6 headers=20 connections=50 benchmarker='wrk'                      ***      6.00 %       ±0.70%  ±0.94%  ±1.22%
http/set_header.js n=1000000 value='Connection'                                                                   0.60 %       ±1.90%  ±2.52%  ±3.29%
http/set_header.js n=1000000 value='Content-Length'                                                              -0.10 %       ±1.50%  ±2.00%  ±2.60%
http/set_header.js n=1000000 value='Content-Type'                                                                -1.50 %       ±1.93%  ±2.57%  ±3.35%
http/set_header.js n=1000000 value='Set-Cookie'                                                                   0.89 %       ±1.72%  ±2.29%  ±2.97%
http/set_header.js n=1000000 value='Transfer-Encoding'                                                           -0.76 %       ±1.25%  ±1.66%  ±2.16%
http/set_header.js n=1000000 value='Vary'                                                                 **      2.55 %       ±1.86%  ±2.48%  ±3.23%
http/set_header.js n=1000000 value='X-Powered-By'                                                                 0.49 %       ±1.43%  ±1.91%  ±2.48%
http/set-header.js duration=5 res='normal' benchmarker='wrk'                                             ***      6.01 %       ±0.71%  ±0.95%  ±1.24%
http/set-header.js duration=5 res='setHeader' benchmarker='wrk'                                          ***      6.32 %       ±0.88%  ±1.17%  ±1.52%
http/set-header.js duration=5 res='setHeaderWH' benchmarker='wrk'                                        ***      5.77 %       ±0.94%  ±1.25%  ±1.64%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=1 len=1024 type='buffer' benchmarker='wrk'            ***      6.61 %       ±0.98%  ±1.31%  ±1.72%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=1 len=1024 type='bytes' benchmarker='wrk'             ***      6.41 %       ±0.86%  ±1.15%  ±1.51%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=1 len=102400 type='buffer' benchmarker='wrk'          ***      2.43 %       ±0.80%  ±1.07%  ±1.40%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=1 len=102400 type='bytes' benchmarker='wrk'           ***      2.06 %       ±0.81%  ±1.08%  ±1.42%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=1 len=4 type='buffer' benchmarker='wrk'               ***      6.02 %       ±0.99%  ±1.32%  ±1.73%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=1 len=4 type='bytes' benchmarker='wrk'                ***      6.14 %       ±1.10%  ±1.48%  ±1.94%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=4 len=1024 type='buffer' benchmarker='wrk'            ***      6.38 %       ±0.90%  ±1.21%  ±1.59%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=4 len=1024 type='bytes' benchmarker='wrk'             ***      5.01 %       ±0.99%  ±1.32%  ±1.73%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=4 len=102400 type='buffer' benchmarker='wrk'          ***      3.14 %       ±0.73%  ±0.98%  ±1.29%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=4 len=102400 type='bytes' benchmarker='wrk'           ***      1.97 %       ±0.95%  ±1.28%  ±1.67%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=4 len=4 type='buffer' benchmarker='wrk'               ***      5.93 %       ±0.81%  ±1.09%  ±1.42%
http/simple.js duration=5 chunkedEnc=0 c=50 chunks=4 len=4 type='bytes' benchmarker='wrk'                ***      6.07 %       ±0.77%  ±1.03%  ±1.35%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=1 len=1024 type='buffer' benchmarker='wrk'           ***      4.12 %       ±1.08%  ±1.44%  ±1.91%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=1 len=1024 type='bytes' benchmarker='wrk'            ***      5.01 %       ±1.27%  ±1.70%  ±2.23%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=1 len=102400 type='buffer' benchmarker='wrk'         ***      2.59 %       ±0.92%  ±1.23%  ±1.62%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=1 len=102400 type='bytes' benchmarker='wrk'          ***      1.53 %       ±0.78%  ±1.05%  ±1.38%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=1 len=4 type='buffer' benchmarker='wrk'              ***      5.40 %       ±0.91%  ±1.21%  ±1.59%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=1 len=4 type='bytes' benchmarker='wrk'               ***      5.55 %       ±1.14%  ±1.53%  ±2.01%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=4 len=1024 type='buffer' benchmarker='wrk'           ***      5.03 %       ±1.13%  ±1.52%  ±2.00%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=4 len=1024 type='bytes' benchmarker='wrk'            ***      4.89 %       ±0.86%  ±1.15%  ±1.51%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=4 len=102400 type='buffer' benchmarker='wrk'         ***      1.93 %       ±0.92%  ±1.24%  ±1.62%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=4 len=102400 type='bytes' benchmarker='wrk'          ***      2.38 %       ±0.77%  ±1.03%  ±1.35%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=4 len=4 type='buffer' benchmarker='wrk'              ***      6.09 %       ±0.99%  ±1.33%  ±1.74%
http/simple.js duration=5 chunkedEnc=0 c=500 chunks=4 len=4 type='bytes' benchmarker='wrk'               ***      5.98 %       ±1.05%  ±1.41%  ±1.87%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=1 len=1024 type='buffer' benchmarker='wrk'            ***      4.79 %       ±0.98%  ±1.31%  ±1.72%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=1 len=1024 type='bytes' benchmarker='wrk'             ***      4.51 %       ±1.01%  ±1.36%  ±1.80%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=1 len=102400 type='buffer' benchmarker='wrk'          ***      2.49 %       ±0.74%  ±0.99%  ±1.30%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=1 len=102400 type='bytes' benchmarker='wrk'                    1.47 %       ±1.72%  ±2.30%  ±3.01%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=1 len=4 type='buffer' benchmarker='wrk'               ***      5.10 %       ±0.97%  ±1.30%  ±1.70%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=1 len=4 type='bytes' benchmarker='wrk'                ***      5.19 %       ±0.83%  ±1.11%  ±1.45%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=4 len=1024 type='buffer' benchmarker='wrk'            ***      5.58 %       ±1.12%  ±1.50%  ±1.97%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=4 len=1024 type='bytes' benchmarker='wrk'             ***      4.72 %       ±0.89%  ±1.19%  ±1.56%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=4 len=102400 type='buffer' benchmarker='wrk'           **      1.93 %       ±1.11%  ±1.49%  ±1.95%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=4 len=102400 type='bytes' benchmarker='wrk'           ***      3.02 %       ±1.31%  ±1.75%  ±2.30%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=4 len=4 type='buffer' benchmarker='wrk'               ***      4.70 %       ±0.92%  ±1.24%  ±1.63%
http/simple.js duration=5 chunkedEnc=1 c=50 chunks=4 len=4 type='bytes' benchmarker='wrk'                ***      4.62 %       ±0.73%  ±0.97%  ±1.28%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=1 len=1024 type='buffer' benchmarker='wrk'           ***      5.72 %       ±1.30%  ±1.74%  ±2.28%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=1 len=1024 type='bytes' benchmarker='wrk'            ***      5.08 %       ±1.12%  ±1.50%  ±1.97%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=1 len=102400 type='buffer' benchmarker='wrk'         ***      2.51 %       ±0.87%  ±1.16%  ±1.52%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=1 len=102400 type='bytes' benchmarker='wrk'            *      1.83 %       ±1.61%  ±2.15%  ±2.82%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=1 len=4 type='buffer' benchmarker='wrk'              ***      4.66 %       ±0.99%  ±1.32%  ±1.74%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=1 len=4 type='bytes' benchmarker='wrk'               ***      4.10 %       ±1.14%  ±1.53%  ±2.01%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=4 len=1024 type='buffer' benchmarker='wrk'           ***      4.59 %       ±1.00%  ±1.33%  ±1.76%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=4 len=1024 type='bytes' benchmarker='wrk'            ***      3.69 %       ±0.97%  ±1.30%  ±1.70%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=4 len=102400 type='buffer' benchmarker='wrk'         ***      2.93 %       ±0.55%  ±0.73%  ±0.96%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=4 len=102400 type='bytes' benchmarker='wrk'          ***      1.88 %       ±0.94%  ±1.26%  ±1.66%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=4 len=4 type='buffer' benchmarker='wrk'              ***      4.29 %       ±0.80%  ±1.07%  ±1.41%
http/simple.js duration=5 chunkedEnc=1 c=500 chunks=4 len=4 type='bytes' benchmarker='wrk'               ***      4.83 %       ±0.77%  ±1.03%  ±1.35%
  • Significant boost for http/simple (up to 6.61%, on about 4.5% average, consistent improvements for all cases).
  • Nice but smaller improvements across all other HTTP tests, which tend to cover some the same ground with extra additions.
  • No significant regressions.

Comment thread lib/internal/async_context_frame.js
@legendecas legendecas added async_local_storage AsyncLocalStorage request-ci Add this label to start a Jenkins CI on a PR. labels Aug 25, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 25, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_local_storage AsyncLocalStorage needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants