-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
src: improve StringBytes::Encode perf on UTF8 #61131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ChALkeR
wants to merge
1
commit into
nodejs:main
Choose a base branch
from
ChALkeR:chalker/non-ascii/0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+20
−0
Conversation
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
5b2b040 to
aee5408
Compare
aee5408 to
118db5f
Compare
Member
Author
|
As #61119 landed, this is now ready. Rebased. |
118db5f to
f1d3a0e
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #61131 +/- ##
==========================================
- Coverage 88.52% 88.52% -0.01%
==========================================
Files 704 704
Lines 208802 208895 +93
Branches 40318 40334 +16
==========================================
+ Hits 184842 184924 +82
+ Misses 15947 15940 -7
- Partials 8013 8031 +18
🚀 New features to boost your workflow:
|
gurgunday
reviewed
Jan 17, 2026
gurgunday
reviewed
Jan 17, 2026
05e960e to
7a1aaa5
Compare
Co-authored-by: Gürgün Dayıoğlu <[email protected]>
7a1aaa5 to
d4f0460
Compare
ChALkeR
commented
Jan 18, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
buffer
Issues and PRs related to the buffer subsystem.
c++
Issues and PRs that require attention from people who are familiar with C++.
needs-ci
PRs that need a full CI run.
performance
Issues and PRs related to the performance of Node.js.
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.
Tracking: #61041
Most data is valid utf-8, no need to wait for v8 optimizations or for simdutf implementing fast replacement.
We can just check + simdutf in fast case.
This is a 2x-10x speedup according to https://github.com/lemire/jstextdecoderbench bench (+ I added extra cases)
There is still room for improvement here (e.g. avoiding triple scans), but this change alone improves results significantly
We can improve further iteratively
This performs mallocs only for valid strings, instead of optimistically malloc-ing and decoding until error
Switching that behavior to optimistic would be a separate PR (perf needs to be checked against this not main or #61119)
Buffer#toString() - utf8
pre-#61119:
main with #61119 (landed):
PR:
TextDecoder, loose
pre-#61119:
main with #61119 (landed):
PR:
TextDecoder, fatal
pre-#61119:
main with #61119 (landed):
PR:
cc @nodejs/performance