-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
buffer: consolidate encoding parsing #29217
buffer: consolidate encoding parsing #29217
Conversation
@nodejs/buffer This could use some reviews. |
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.
Nice work, some impressive speedups!
throw new ERR_INVALID_ARG_TYPE( | ||
'string', ['string', 'Buffer', 'ArrayBuffer'], string | ||
); | ||
const encodingOps = { |
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.
Maybe add a comment that for performance reasons it's imperative that all the entries have the same shape / hidden map? (I.e., users of an ops object shouldn't go poly- or megamorphic.)
This comment has been minimized.
This comment has been minimized.
cb09531
to
9c7149a
Compare
PR-URL: nodejs#29217 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: nodejs#29217 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
9c7149a
to
5dc5cfb
Compare
PR-URL: #29217 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #29217 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #29217 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #29217 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
The assignment to the encoding variable has no effect. Refs: nodejs#29217
The assignment to the encoding variable has no effect. Refs: #29217 PR-URL: #50199 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
The assignment to the encoding variable has no effect. Refs: #29217 PR-URL: #50199 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
The assignment to the encoding variable has no effect. Refs: nodejs#29217 PR-URL: nodejs#50199 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
The assignment to the encoding variable has no effect. Refs: #29217 PR-URL: #50199 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This consolidates encoding parsing for
buffer
at both the JS and C++ levels (onlyfill()
still parses the encoding twice). Doing so not only cleans things up but also improves performance in some cases.Various relevant benchmark results:
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes