util: reduce TextEncoder.encodeInto function size#60339
Merged
nodejs-github-bot merged 1 commit intoOct 23, 2025
Conversation
edabae3 to
b7f7334
Compare
Member
Author
|
cc @nodejs/tsc due to semver-major |
b7f7334 to
ef0b9c2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60339 +/- ##
==========================================
- Coverage 92.20% 88.59% -3.62%
==========================================
Files 345 704 +359
Lines 138924 208473 +69549
Branches 22203 40066 +17863
==========================================
+ Hits 128094 184691 +56597
- Misses 10601 15798 +5197
- Partials 229 7984 +7755
🚀 New features to boost your workflow:
|
ljharb
approved these changes
Oct 21, 2025
ljharb
left a comment
Member
There was a problem hiding this comment.
should the same changes be made for TextDecoder?
Member
Author
Yes, I'll open a separate pull-request for TextDecoder. |
joyeecheung
approved these changes
Oct 21, 2025
joyeecheung
left a comment
Member
There was a problem hiding this comment.
LGTM, I always feel that ERR_INVALID_THIS isn't a super useful specialized error as usually that just indicates that there's a bug in your program and it should be fixed; there isn't really much of a point to catch it and try again (how is one supposed to retry, anyway?)
Collaborator
legendecas
approved these changes
Oct 21, 2025
Collaborator
Collaborator
|
Landed in ddbe136 |
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.
It seems encodeInto function is too big to inline with v8. This is an attempt to reduce the size of the function by eliminating validateEncoder() calls, and replacing them with private attribute calls.
This is a semver-major because it changes the errors thrown if
thisis different.Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1743/