module: avoid dictionary-mode objects on hot paths #67552
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
legendecas
V8 keeps objects created from
{ __proto__: null }literals, and fromv8::Object::New()with names and values, in dictionary mode for theirwhole life. The module loader created such objects on every
require()of abuiltin and every
import(), andkEmptyObject, the cached ESM resolveresults and the requests from
getModuleRequests()were all in dictionarymode 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.kEmptyObjectis used across core, so that partis not limited to the module loader.
This adds
benchmark/module/module-require-builtin.js, since no existingbenchmark isolates repeated
require()of builtins.esm/startup-esm-graph.jswith 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.