build,src,crypto: improve startup performance - #65549
Draft
avivkeller wants to merge 3 commits into
Draft
Conversation
Collaborator
|
Review requested:
|
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 <me@aviv.sh>
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 <me@aviv.sh>
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 <me@aviv.sh>
avivkeller
force-pushed
the
startup-perf
branch
from
August 25, 2026 19:04
78b0626 to
2dffdbf
Compare
Member
|
Please separate out the crypto ones into a separate PR and coordinate with @panva ... he has some other edits that may conflict. |
Member
avivkeller
marked this pull request as draft
August 25, 2026 19:07
Member
|
Thank you |
Codecov Report❌ Patch coverage is
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
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
(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:
atexit(), since it's slow (dladdr()performs an expensive linear scan of the executable's symbol table)atexit(), this time in OpenSSL.On my mac, improves startups by ~15%: