← Back to Pull requests

module: avoid dictionary-mode objects on hot paths #67552

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

V8 keeps objects created from { __proto__: null } literals, and from
v8::Object::New() with names and values, in dictionary mode for their
whole life. The module loader created such objects on every require() of a
builtin and every import(), and kEmptyObject, the cached ESM resolve
results and the requests from getModuleRequests() were all in dictionary
mode as well.

Use classes with a null-prototype prototype for the per-call objects, null the
prototype of plain literals for the long-lived ones, and build module requests
from a DictionaryTemplate. kEmptyObject is used across core, so that part
is not limited to the module loader.

This adds benchmark/module/module-require-builtin.js, since no existing
benchmark isolates repeated require() of builtins.

                                                          confidence improvement accuracy (*)   (**)   (***)
module/module-require-builtin.js n=1000000 prefix=''             ***    198.93 %       ±5.98% ±8.05% ±10.67%
module/module-require-builtin.js n=1000000 prefix='node:'        ***     68.46 %       ±2.76% ±3.68%  ±4.79%

                                                                       confidence improvement accuracy (*)   (**)   (***)
esm/esm-loader-import.js specifier='./relative-existing.js' n=10000           ***     19.98 %       ±3.47% ±4.66%  ±6.13%
esm/esm-loader-import.js specifier='./relative-nonexistent.js' n=10000                 1.48 %       ±4.40% ±5.86%  ±7.62%
esm/esm-loader-import.js specifier='data:text/javascript,{i}' n=10000          **      6.48 %       ±3.73% ±5.00%  ±6.58%
esm/esm-loader-import.js specifier='node:os' n=10000                          ***     13.32 %       ±6.11% ±8.20% ±10.81%
esm/esm-loader-import.js specifier='node:prefixed-nonexistent' n=10000          *      7.42 %       ±5.64% ±7.54%  ±9.88%

esm/startup-esm-graph.js with 2000 modules is not significant over 20 runs
(+11.04% ±11.72%).

Refs: https://adventures.nodeland.dev/archive/optimizing-objects-with-null-prototypes/

---

AI Generated.

Diff: 258 lines (+193 / -65) across 3 files Reviewer: legendecas Review duration: 2885m
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 258 lines diff across 3 files
0.39
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.332
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #67552"
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.2% (MEDIUM) · Higher = larger blast radius
39.2%
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.5% · Safe to merge
15.5%
Repository