Skip to content

src: reuse cached strings in CompileSerializeMain - #65453

Open
agape1225 wants to merge 1 commit into
nodejs:mainfrom
agape1225:src-snapshotable-reuse-cached-strings
Open

src: reuse cached strings in CompileSerializeMain#65453
agape1225 wants to merge 1 commit into
nodejs:mainfrom
agape1225:src-snapshotable-reuse-cached-strings

Conversation

@agape1225

Copy link
Copy Markdown
Contributor

CompileSerializeMain() created new "require", "__filename", and "__dirname" strings via FIXED_ONE_BYTE_STRING() on every call, even though these strings are already cached on IsolateData/Environment as require_string(), __filename_string(), and __dirname_string() (defined via PER_ISOLATE_STRING_PROPERTIES in src/env_properties.h) and are reused this way elsewhere (e.g. the sibling RunEmbedderPreload() already obtains Environment* the same way).

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Aug 21, 2026
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.06%. Comparing base (21f0f27) to head (c01d966).
⚠️ Report is 130 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65453      +/-   ##
==========================================
- Coverage   90.12%   90.06%   -0.06%     
==========================================
  Files         752      751       -1     
  Lines      252315   254875    +2560     
  Branches    47444    48111     +667     
==========================================
+ Hits       227395   229553    +2158     
- Misses      16217    16487     +270     
- Partials     8703     8835     +132     
Files with missing lines Coverage Δ
src/node_snapshotable.cc 73.53% <100.00%> (ø)

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

daeyeon pushed a commit to ossca-node/board that referenced this pull request Aug 26, 2026
CompileSerializeMain() created new "require", "__filename", and
"__dirname" strings via FIXED_ONE_BYTE_STRING() on every call, even
though these strings are already cached on IsolateData/Environment
as require_string(), __filename_string(), and __dirname_string()
(defined via PER_ISOLATE_STRING_PROPERTIES in src/env_properties.h)
and are reused this way elsewhere (e.g. the sibling
RunEmbedderPreload() already obtains Environment* the same way).

Signed-off-by: agape1225 <49804691+agape1225@users.noreply.github.com>
@agape1225
agape1225 force-pushed the src-snapshotable-reuse-cached-strings branch from 97f69fe to c01d966 Compare August 27, 2026 12:04
@addaleax addaleax added author ready PRs that have at least one approval, no outstanding review comments, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Aug 27, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 27, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants