src: use stack allocation for small string encoding#62431
Merged
nodejs-github-bot merged 2 commits intonodejs:mainfrom Apr 9, 2026
Merged
src: use stack allocation for small string encoding#62431nodejs-github-bot merged 2 commits intonodejs:mainfrom
nodejs-github-bot merged 2 commits intonodejs:mainfrom
Conversation
e5fbafb to
43fd2f8
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62431 +/- ##
==========================================
+ Coverage 89.77% 89.80% +0.02%
==========================================
Files 697 697
Lines 215749 215755 +6
Branches 41304 41285 -19
==========================================
+ Hits 193681 193751 +70
+ Misses 14161 14123 -38
+ Partials 7907 7881 -26
🚀 New features to boost your workflow:
|
Flarna
reviewed
Mar 26, 2026
43fd2f8 to
73eb342
Compare
ronag
reviewed
Mar 29, 2026
ronag
reviewed
Mar 29, 2026
ronag
reviewed
Mar 29, 2026
ronag
approved these changes
Mar 29, 2026
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Use stack-allocated buffers in StringBytes::Encode() for small inputs instead of heap-allocating via UncheckedMalloc for every call. Refs: nodejs/performance#194
fd449b1 to
f38c303
Compare
jasnell
approved these changes
Apr 8, 2026
Flarna
approved these changes
Apr 8, 2026
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
Collaborator
|
Landed in 70c1d6b |
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.
EncodeOneByteString/EncodeTwoByteStringhelper templates inStringBytes::Encode()that use a 512 byte (256-char for two-byte) stack buffer for small inputs, falling back to heap allocation +ExternStringfor larger ones.Refs: nodejs/performance#194