GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — esm: avoid dictionary-mode objects in import() by mcollina · Pull Request #67554 · nodejs/node

Conversation

@mcollina

@mcollina mcollina commented Nov 17, 2026

Copy link
Copy Markdown
Member

Import attributes were created in C++ with v8::Object::New() and a null
prototype, once per module request and once per import() call. Every
import() call also created a { __proto__: null } diagnostics_channel
context, which was discarded when module.import had no subscribers. V8
creates all of these in dictionary mode.

Build the attributes from an ordinary object with its prototype set to null,
and only create the trace context when there are subscribers. The attributes
are still frozen with a null prototype.

This is independent of #67552, and the two
merge cleanly.

                                                                       confidence improvement accuracy (*)   (**)  (***)
esm/esm-loader-import.js specifier='./relative-existing.js' n=10000           ***      7.24 %       ±1.13% ±1.50% ±1.96%
esm/esm-loader-import.js specifier='./relative-nonexistent.js' n=10000        ***      1.98 %       ±1.02% ±1.36% ±1.77%
esm/esm-loader-import.js specifier='data:text/javascript,{i}' n=10000                  1.27 %       ±1.82% ±2.42% ±3.16%
esm/esm-loader-import.js specifier='node:os' n=10000                          ***      7.83 %       ±1.36% ±1.81% ±2.36%
esm/esm-loader-import.js specifier='node:prefixed-nonexistent' n=10000        ***      7.27 %       ±1.49% ±1.99% ±2.59%

Refs: #67552


AI Generated.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mcollina
esm: avoid dictionary-mode objects in import()
f4e2267
Import attributes were created in C++ with v8::Object::New() and a
null prototype, once per module request and once per import() call.
Every import() call also created a `{ __proto__: null }`
diagnostics_channel context, which was discarded when module.import
had no subscribers. V8 creates all of these in dictionary mode.

Build the attributes from an ordinary object with its prototype set to
null, and only create the trace context when there are subscribers.

Signed-off-by: Matteo Collina <[email protected]>
@nodejs-github-bot

nodejs-github-bot commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/loaders
  • @nodejs/vm
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. labels Nov 17, 2026
gurgunday
gurgunday approved these changes Nov 17, 2026
View reviewed changes

@gurgunday gurgunday left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
jsumners-nr
jsumners-nr approved these changes Nov 17, 2026
View reviewed changes
aduh95
aduh95 approved these changes Nov 17, 2026
View reviewed changes
@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 17, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 17, 2026
@nodejs-github-bot

nodejs-github-bot commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/79221/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@legendecas

legendecas commented Nov 17, 2026

Copy link
Copy Markdown
Member

V8 has optimized this kind of objects in https://chromium-review.googlesource.com/c/v8/v8/+/8476491 with flag --fast-null-proto-literals (landed yesterday, expected to be included in m160).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

legendecas
legendecas approved these changes Nov 17, 2026
View reviewed changes
@codecov

codecov Bot commented Nov 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.67%. Comparing base (6a536f9) to head (f4e2267).
⚠️ Report is 106 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67554      +/-   ##
==========================================
- Coverage   90.68%   90.67%   -0.01%     
==========================================
  Files         800      800              
  Lines      280556   281000     +444     
  Branches    54179    54293     +114     
==========================================
+ Hits       254412   254795     +383     
- Misses      16262    16299      +37     
- Partials     9882     9906      +24     
Files with missing lines Coverage Δ
lib/internal/modules/esm/loader.js 99.56% <100.00%> (+<0.01%) ⬆️
src/module_wrap.cc 74.33% <100.00%> (-0.08%) ⬇️

... and 47 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mcollina mcollina added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 18, 2026
jasnell
jasnell approved these changes Nov 18, 2026
View reviewed changes
@nodejs-github-bot nodejs-github-bot added commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. and removed commit-queue PRs queued for automated landing through the Commit Queue. labels Nov 19, 2026
@nodejs-github-bot

nodejs-github-bot commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Commit Queue failed

   ✖  1 GitHub CI job(s) cancelled:
   ✖    - lint-cpp: CANCELLED (https://github.com/nodejs/node/actions/runs/44141117363/job/134243858090)

The pull request was removed from the Commit Queue and labeled commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. . After resolving the failure, remove that label and add commit-queue PRs queued for automated landing through the Commit Queue. to retry.

Full Commit Queue output
�[36m⠋�[39m Loading data for nodejs/node/pull/67554
�[36m⠋�[39m Loading data for nodejs/node/pull/67554
�[36m⠋�[39m Getting collaborator contacts from README of nodejs/node
�[36m⠋�[39m Getting PR from nodejs/node/pull/67554
�[36m⠋�[39m Getting reviews from nodejs/node/pull/67554
�[36m⠋�[39m Getting comments from nodejs/node/pull/67554
�[36m⠋�[39m Getting commits from nodejs/node/pull/67554
✔  Done loading data for nodejs/node/pull/67554
----------------------------------- PR info ------------------------------------
Title      esm: avoid dictionary-mode objects in import() (#67554)
Author     Matteo Collina <[email protected]> (@mcollina)
Branch     mcollina:esm-import-fast-objects -> nodejs:main
Labels     c++, esm, needs-ci, commit-queue
Commits    1
 - esm: avoid dictionary-mode objects in import()
Committers 1
 - Matteo Collina <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/67554
Refs: https://github.com/nodejs/node/pull/67552
Reviewed-By: Gürgün Dayıoğlu <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/67554
Refs: https://github.com/nodejs/node/pull/67552
Reviewed-By: Gürgün Dayıoğlu <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Tue, 17 Nov 2026 17:49:00 GMT
   ✔  Approvals: 4
   ✔  - Gürgün Dayıoğlu (@gurgunday): https://github.com/nodejs/node/pull/67554#pullrequestreview-5943786020
   ✔  - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/67554#pullrequestreview-5943909696
   ✔  - Chengzhong Wu (@legendecas) (TSC): https://github.com/nodejs/node/pull/67554#pullrequestreview-5944473418
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/67554#pullrequestreview-5956660307
   ✖  1 GitHub CI job(s) cancelled:
   ✖    - lint-cpp: CANCELLED (https://github.com/nodejs/node/actions/runs/44141117363/job/134243858090)
   ℹ  Last Full PR CI on 2026-11-17T18:16:22Z: https://ci.nodejs.org/job/node-test-pull-request/79221/
�[36m⠙�[39m Querying data for job/node-test-pull-request/79221/
�[36m⠙�[39m Querying data for job/node-test-pull-request/79221/
�[36m⠙�[39m Querying API for job/node-test-pull-request/79221/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu

View workflow run

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mcollina mcollina added commit-queue PRs queued for automated landing through the Commit Queue. and removed commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. labels Nov 21, 2026
@nodejs-github-bot
nodejs-github-bot merged commit ce44266 into nodejs:main Nov 21, 2026
97 of 98 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Landed in ce44266

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 21, 2026
aduh95 pushed a commit that referenced this pull request Nov 23, 2026
@mcollina @aduh95
esm: avoid dictionary-mode objects in import()
43e6622
Import attributes were created in C++ with v8::Object::New() and a
null prototype, once per module request and once per import() call.
Every import() call also created a `{ __proto__: null }`
diagnostics_channel context, which was discarded when module.import
had no subscribers. V8 creates all of these in dictionary mode.

Build the attributes from an ordinary object with its prototype set to
null, and only create the trace context when there are subscribers.

Signed-off-by: Matteo Collina <[email protected]>
PR-URL: #67554
Refs: #67552
Reviewed-By: Gürgün Dayıoğlu <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@github-actions github-actions Bot mentioned this pull request Nov 24, 2026
2026-11-25, Version 27.0.0-alpha.0.2.0 (Alpha) #67757
Merged
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@mcollina @gabylb
esm: avoid dictionary-mode objects in import()
de5722e
Import attributes were created in C++ with v8::Object::New() and a
null prototype, once per module request and once per import() call.
Every import() call also created a `{ __proto__: null }`
diagnostics_channel context, which was discarded when module.import
had no subscribers. V8 creates all of these in dictionary mode.

Build the attributes from an ordinary object with its prototype set to
null, and only create the trace context when there are subscribers.

Signed-off-by: Matteo Collina <[email protected]>
PR-URL: nodejs#67554
Refs: nodejs#67552
Reviewed-By: Gürgün Dayıoğlu <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@legendecas legendecas legendecas approved these changes
@aduh95 aduh95 aduh95 approved these changes
@gurgunday gurgunday gurgunday approved these changes
+1 more reviewer
@jsumners-nr jsumners-nr jsumners-nr approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@mcollina @nodejs-github-bot @legendecas @jasnell @aduh95 @gurgunday @jsumners-nr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.