Skip to content

Conversation

@joyeecheung
Copy link
Member

@joyeecheung joyeecheung commented Oct 31, 2025

Instead of polyfilling it with vm.SourceTextModule, use a built-in source text module loader so that we can also build the code cache for it at build time to embed the code cache for them in the binary.

Drive-by: instead of inferring how to compile a particular built-in at run time, do the inferring at build time, so the function-based built-ins can be compiled using parameters quickly looked up from a static map, and the builtins that should be compiled as source text modules are known internally based on extension in the source code (at run time, the extensions are all removed).

ubuntu:~/node$ hyperfine "./node_main --prof-process isolate-0xb1f93ebf0000-17508-v8.log" "out/Release/node --prof-process isolate-0xb1f93ebf0000-17508-v8.log"
Benchmark 1: ./node_main --prof-process isolate-0xb1f93ebf0000-17508-v8.log
  Time (mean ± σ):     267.6 ms ±   7.6 ms    [User: 197.7 ms, System: 116.8 ms]
  Range (min … max):   259.5 ms … 282.7 ms    10 runs

Benchmark 2: out/Release/node --prof-process isolate-0xb1f93ebf0000-17508-v8.log
  Time (mean ± σ):     248.7 ms ±   6.4 ms    [User: 175.8 ms, System: 119.5 ms]
  Range (min … max):   243.1 ms … 264.6 ms    12 runs

Summary
  out/Release/node --prof-process isolate-0xb1f93ebf0000-17508-v8.log ran
    1.08 ± 0.04 times faster than ./node_main --prof-process isolate-0xb1f93ebf0000-17508-v8.log

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Oct 31, 2025
@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 72.72727% with 87 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.54%. Comparing base (d137969) to head (9f14eb9).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
src/node_builtins.cc 74.31% 27 Missing and 29 partials ⚠️
src/builtin_info.cc 0.00% 25 Missing ⚠️
lib/internal/v8_prof_polyfill.js 89.36% 5 Missing ⚠️
lib/internal/main/prof_process.js 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #60518      +/-   ##
==========================================
+ Coverage   88.53%   88.54%   +0.01%     
==========================================
  Files         703      703              
  Lines      208077   208209     +132     
  Branches    40083    40143      +60     
==========================================
+ Hits       184214   184356     +142     
+ Misses      15881    15864      -17     
- Partials     7982     7989       +7     
Files with missing lines Coverage Δ
src/api/environment.cc 76.54% <100.00%> (-0.18%) ⬇️
src/node_builtins.h 100.00% <ø> (ø)
lib/internal/main/prof_process.js 97.29% <96.42%> (-2.71%) ⬇️
lib/internal/v8_prof_polyfill.js 75.25% <89.36%> (+20.28%) ⬆️
src/builtin_info.cc 0.00% <0.00%> (ø)
src/node_builtins.cc 76.47% <74.31%> (-2.86%) ⬇️

... and 42 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.

@joyeecheung joyeecheung force-pushed the tickprocessor-esm branch 4 times, most recently from 236bdfd to 20a06e2 Compare November 2, 2025 15:08
@nodejs nodejs deleted a comment from nodejs-github-bot Nov 2, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@joyeecheung joyeecheung force-pushed the tickprocessor-esm branch 2 times, most recently from 3a7fcdf to 02c871f Compare November 9, 2025 12:18
Instead of polyfilling it with vm.SourceTextModule,
use a built-in source text module loader so that we can
also build the code cache for it at build tiem to
embed the code cache for them in the binary.

Drive-by: instead of inferring how to compile a particular
built-in at run time, do the inferring at build time,
so the function-based built-ins can be compiled using
parameters quickly looked up from a static map, and
the builtins that should be compiled as source text
modules are known internally based on extension in
the source code (at run time, the extensions are all
removed).
@nodejs-github-bot
Copy link
Collaborator

Copy link
Contributor

@Aditi-1400 Aditi-1400 left a comment

Choose a reason for hiding this comment

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

LGTM

@nodejs-github-bot
Copy link
Collaborator

@joyeecheung joyeecheung added the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 11, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 11, 2025
@nodejs-github-bot nodejs-github-bot merged commit 12fad1b into nodejs:main Nov 11, 2025
62 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 12fad1b

targos pushed a commit that referenced this pull request Nov 27, 2025
Instead of polyfilling it with vm.SourceTextModule,
use a built-in source text module loader so that we can
also build the code cache for it at build tiem to
embed the code cache for them in the binary.

Drive-by: instead of inferring how to compile a particular
built-in at run time, do the inferring at build time,
so the function-based built-ins can be compiled using
parameters quickly looked up from a static map, and
the builtins that should be compiled as source text
modules are known internally based on extension in
the source code (at run time, the extensions are all
removed).

PR-URL: #60518
Reviewed-By: Aditi Singh <aditisingh1400@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants