-
Notifications
You must be signed in to change notification settings - Fork 2.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
perf(node:util): fast path for extractedSplitNewLines
#15838
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.
i think on my end, i should make the bindings generator pass WTFString
instead of bun.String
, since it will always be of the WTFStringImpl tag. this is significant because the input to this function is always latin1
or utf16
, and never utf8
. checking for the utf8
encoding in this function shouldn't be done since it wont ever be present.
Co-authored-by: Don Isaac <don@bun.sh> Co-authored-by: DonIsaac <DonIsaac@users.noreply.github.com>
Pull Request is not mergeable
Co-authored-by: Don Isaac <don@bun.sh> Co-authored-by: DonIsaac <DonIsaac@users.noreply.github.com>
extractedSplitNewLines
uses a regex with a positive lookahead to spit strings by newlines. Benchmarks show that this causesinspect
to be ~2-3x slower than node when this codepath is hit. This PR adds a fast path when the object being split is known to be a string.We cannot run this fast path in all cases since splitting via a regexp respects
Symbol.split
.