-
Notifications
You must be signed in to change notification settings - Fork 28.6k
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: optimize asciiWrite for short strings #53071
Conversation
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.
This should call v8's WriteOneByte more or less directly, so it is hard to beat (for sufficiently long strings).
I don't undestand the test failure. |
@@ -962,6 +962,16 @@ class FastBuffer extends Uint8Array { | |||
} | |||
} | |||
|
|||
function _asciiWrite(string, offset, length) { | |||
if (length <= 32) { |
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 think some error checking might be missing here.
This was more work than I initially assumed. |
Based on benchmark: