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.78481% with 86 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.53%. Comparing base (684c3b3) to head (da02e54).
⚠️ Report is 18 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 ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #60518      +/-   ##
==========================================
- Coverage   88.56%   88.53%   -0.03%     
==========================================
  Files         704      704              
  Lines      207858   207972     +114     
  Branches    40058    40091      +33     
==========================================
+ Hits       184089   184131      +42     
- Misses      15807    15850      +43     
- Partials     7962     7991      +29     
Files with missing lines Coverage Δ
lib/internal/main/prof_process.js 100.00% <100.00%> (ø)
src/api/environment.cc 76.54% <100.00%> (-0.35%) ⬇️
src/node_builtins.h 100.00% <ø> (ø)
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.28% <74.31%> (-3.29%) ⬇️

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

@nodejs-github-bot
Copy link
Collaborator

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.

2 participants