-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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: add fast path for Latin1 decoding #55275
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
2dd0714
to
b871573
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #55275 +/- ##
==========================================
- Coverage 88.41% 88.40% -0.02%
==========================================
Files 652 652
Lines 186612 186641 +29
Branches 36062 36068 +6
==========================================
+ Hits 165001 165003 +2
- Misses 14885 14910 +25
- Partials 6726 6728 +2
|
Can you update benchmarks as well? |
@@ -443,6 +446,10 @@ function makeTextDecoderICU() { | |||
return decodeUTF8(input, this[kIgnoreBOM], this[kFatal]); | |||
} | |||
|
|||
if (this[kLatin1FastPath]) { |
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.
After Line 443, we need this, since we don't support options.stream on the fast path.
this[kLatin1FastPath] &&= !(options?.stream)
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.
I will apply it as you say, thank you.
lib/internal/encoding.js
Outdated
@@ -443,6 +446,10 @@ function makeTextDecoderICU() { | |||
return decodeUTF8(input, this[kIgnoreBOM], this[kFatal]); | |||
} | |||
|
|||
if (this[kLatin1FastPath]) { | |||
return decodeLatin1(input); |
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.
You should support ignore bom, and fatal values as well.
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.
I made an update covering this, thank you
Co-authored-by: Yagiz Nizipli <[email protected]>
I wonder if this is the right place. |
I added a fast path for Latin1 (windows-1252) decoding to improve performance. This change avoids using the slower ICU-based decoding for Latin1 and instead utilizes a direct approach, similar to the fast path implemented for UTF-8.
nodejs/performance#178