← Back to Pull requests

src: stop shrinking async resource stack on pop #67362

Closed
unknown closed this pull request without merging on Nov 09, 2026 20:17 UTC
View on GitHub
unknown unknown commented on Nov 09, 2026 19:50 UTC
Author

pop_async_context() called shrink_to_fit() on every pop. The stack is usually empty once a callback returns, so libc++ and MSVC free the deque's storage and the next push allocates it again. That happens several times per HTTP request.

The shrink used to run only when the stack was large and mostly unused. That check was dropped in #56457.

Measured on macOS (Apple M2, libc++). libstdc++ skips the free in this case, so the gain on Linux is likely small.

<details>
<summary>benchmark/http/simple.js</summary>

                                                                                              confidence   improvement   accuracy (*)    (**)   (***)
http/simple.js duration=3 chunkedEnc=0 c=50 chunks=1 len=4 type='bytes' benchmarker='wrk'     ***             +4.44 %   ±2.15%  ±2.92%  ±3.93%
http/simple.js duration=3 chunkedEnc=1 c=50 chunks=1 len=4 type='bytes' benchmarker='wrk'                     +1.39 %   ±1.79%  ±2.44%  ±3.31%
http/simple.js duration=3 chunkedEnc=0 c=50 chunks=4 len=4 type='bytes' benchmarker='wrk'       *             +2.25 %   ±1.93%  ±2.63%  ±3.54%
http/simple.js duration=3 chunkedEnc=1 c=50 chunks=4 len=4 type='bytes' benchmarker='wrk'      **             +2.26 %   ±1.40%  ±1.91%  ±2.57%
http/simple.js duration=3 chunkedEnc=0 c=50 chunks=1 len=1024 type='bytes' benchmarker='wrk'  ***             +2.46 %   ±0.94%  ±1.29%  ±1.75%
http/simple.js duration=3 chunkedEnc=1 c=50 chunks=1 len=1024 type='bytes' benchmarker='wrk'   **             +1.92 %   ±1.39%  ±1.89%  ±2.56%
http/simple.js duration=3 chunkedEnc=0 c=50 chunks=4 len=1024 type='bytes' benchmarker='wrk'  ***             +1.93 %   ±0.80%  ±1.09%  ±1.46%
http/simple.js duration=3 chunkedEnc=1 c=50 chunks=4 len=1024 type='bytes' benchmarker='wrk'  ***             +2.91 %   ±1.19%  ±1.62%  ±2.19%

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

</details>

Refs: <https://github.com/nodejs/node/pull/56457>

Diff: 288 lines (+216 / -72) across 3 files Reviewer: gurgunday Review duration: 27m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 288 lines diff across 3 files
0.40
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.339
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #67362"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.8% (MEDIUM) · Higher = larger blast radius
39.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.7% · Safe to merge
15.7%
Repository