-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
util: reduce TextEncoder.encodeInto function size #60339
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
util: reduce TextEncoder.encodeInto function size #60339
Conversation
edabae3 to
b7f7334
Compare
|
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the same changes be made for TextDecoder?
Yes, I'll open a separate pull-request for TextDecoder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?)
|
Landed in ddbe136 |
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/