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 — build,src,crypto: improve startup performance by avivkeller · Pull Request #65549 · nodejs/node

Conversation

@avivkeller

@avivkeller avivkeller commented Aug 25, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

(I can split these into separate PRs if needed, but I figured a single PR with separate commits would be sufficient since the changes are related: ce94bb8 made me think about 2dffdbf, which in turn relied on a1ba046.)

In order of commits, this:

  • Avoids atexit(), since it's slow (dladdr() performs an expensive linear scan of the executable's symbol table)
  • Lazily-loads well-known Crypto ciphers
  • Once again avoids atexit(), this time in OpenSSL.

On my mac, improves startups by ~15%:

$ hyperfine --warmup 25 --runs 100 'node -e "0"' './node -e "0"'

Benchmark 1: node -e "0"
  Time (mean ± σ):      39.3 ms ±   2.2 ms    [User: 31.6 ms, System: 6.4 ms]
  Range (min … max):    36.5 ms …  55.0 ms    100 runs
 
  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
 
Benchmark 2: ./node -e "0"
  Time (mean ± σ):      34.2 ms ±   2.1 ms    [User: 26.4 ms, System: 6.4 ms]
  Range (min … max):    32.4 ms …  49.3 ms    100 runs
 
  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
 
Summary
  ./node -e "0" ran
    1.15 ± 0.10 times faster than node -e "0"

Sorry, something went wrong.

Uh oh!

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

daniellockyer reacted with rocket emoji
All reactions
  • 🚀 1 reaction
@avivkeller avivkeller added performance Issues and PRs related to the performance of Node.js. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. labels Aug 25, 2026
@nodejs-github-bot

nodejs-github-bot commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/gyp
  • @nodejs/security-wg
  • @nodejs/startup
  • @nodejs/v8-update
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 lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Aug 25, 2026
avivkeller added 3 commits August 25, 2026 15:04
@avivkeller
src: avoid atexit() for ResetStdio
ce94bb8
atexit() calls dladdr() to find the image that
owns the callback. dladdr() performs an expensive
linear scan of the executable's symbol
table, so we now avoid it entirely.

Signed-off-by: Aviv Keller <[email protected]>
@avivkeller
crypto: resolve ciphers lazily
a1ba046
The Cipher::AES_* and Cipher::CHACHA20_POLY1305
constants were initialized by static initializers
while the executable is still being loaded.

Lazily-load them now, so they are only init'd on
first use.

Signed-off-by: Aviv Keller <[email protected]>
@avivkeller
src: do not register OpenSSL's atexit() handler
2dffdbf
Now that crypto no longer initializes OpenSSL
from a static initalizer (see previous commit),
nothing requires OpenSSL to be torn down at process
exit. As mentioned in an earlier commit, `atexit`
is expensive, so we now once again avoid it.

Signed-off-by: Aviv Keller <[email protected]>
@avivkeller
avivkeller force-pushed the startup-perf branch from 78b0626 to 2dffdbf Compare August 25, 2026 19:04
@jasnell

jasnell commented Aug 25, 2026

Copy link
Copy Markdown
Member

Please separate out the crypto ones into a separate PR and coordinate with @panva ... he has some other edits that may conflict.

All reactions

Sorry, something went wrong.

Uh oh!

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

@panva

panva commented Aug 25, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

a1ba046 conflicts with #65484, please hold off updating crypto until those changes land.

avivkeller reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@avivkeller
avivkeller marked this pull request as draft August 25, 2026 19:07
@panva

panva commented Aug 25, 2026

Copy link
Copy Markdown
Member

Thank you

All reactions

Sorry, something went wrong.

Uh oh!

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

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.57143% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.11%. Comparing base (ce40aa2) to head (2dffdbf).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/crypto/crypto_context.cc 77.77% 0 Missing and 2 partials ⚠️
src/node.cc 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65549      +/-   ##
==========================================
- Coverage   90.14%   90.11%   -0.03%     
==========================================
  Files         751      751              
  Lines      253635   253645      +10     
  Branches    47793    47786       -7     
==========================================
- Hits       228632   228574      -58     
- Misses      16249    16315      +66     
- Partials     8754     8756       +2     
Files with missing lines Coverage Δ
src/crypto/crypto_aes.h 33.33% <ø> (ø)
src/crypto/crypto_chacha20_poly1305.cc 52.27% <100.00%> (ø)
src/node.cc 76.58% <75.00%> (-0.07%) ⬇️
src/crypto/crypto_context.cc 71.75% <77.77%> (+0.08%) ⬆️

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

@panva

panva commented Aug 27, 2026

Copy link
Copy Markdown
Member

@avivkeller #65484 is in, i guess you're good to go

avivkeller reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

anonrig
anonrig approved these changes Aug 30, 2026
View reviewed changes
mertcanaltin
mertcanaltin approved these changes Sep 23, 2026
View reviewed changes
@mertcanaltin

mertcanaltin commented Sep 23, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Hi @avivkeller , could you rebase this pr? I guess after we can merge.

All reactions

Sorry, something went wrong.

Uh oh!

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

@daniellockyer

daniellockyer commented Oct 8, 2026

Copy link
Copy Markdown

Funnily enough, I just independently discovered the atexit win and then found this PR. So I'd love to see this land 🙂

All reactions

Sorry, something went wrong.

Uh oh!

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

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

Reviewers

@anonrig anonrig anonrig approved these changes
+1 more reviewer
@mertcanaltin mertcanaltin mertcanaltin 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

commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. performance Issues and PRs related to the performance of Node.js.

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

@avivkeller @nodejs-github-bot @jasnell @panva @mertcanaltin @daniellockyer @anonrig
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 01402503 — 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.