-
Notifications
You must be signed in to change notification settings - Fork 186
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
Replace boundary on StringByteIndexPrimitiveNode
with faster specializations for boundary checks and single-byte-optimizable strings.
#2380
Merged
graalvmbot
merged 1 commit into
oracle:master
from
Shopify:faster-string_byte_index-primitive
Jun 21, 2021
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eregon
reviewed
Jun 18, 2021
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.
Looks good but needs some tweaks.
ToRopeNode seems convenient.
nirvdrum
force-pushed
the
faster-string_byte_index-primitive
branch
from
June 18, 2021 14:11
56e55ba
to
b1520bc
Compare
eregon
reviewed
Jun 18, 2021
nirvdrum
force-pushed
the
faster-string_byte_index-primitive
branch
from
June 18, 2021 14:44
b1520bc
to
83ca5e1
Compare
eregon
approved these changes
Jun 18, 2021
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.
Thanks for the PR and the quick turnaround!
nirvdrum
force-pushed
the
faster-string_byte_index-primitive
branch
from
June 18, 2021 15:02
83ca5e1
to
fc34195
Compare
…lizations for boundary checks and single-byte-optimizable strings.
nirvdrum
force-pushed
the
faster-string_byte_index-primitive
branch
from
June 18, 2021 15:04
fc34195
to
1fcbd1d
Compare
graalvmbot
pushed a commit
that referenced
this pull request
Jun 21, 2021
…er specializations for boundary checks and single-byte-optimizable strings (#2380) PullRequest: truffleruby/2742
LillianZ
pushed a commit
to Shopify/truffleruby
that referenced
this pull request
Jun 22, 2021
with faster specializations for boundary checks and single-byte-optimizable strings. (Mirroring StringByteIndexPrimitiveNode after improvements in oracle#2380).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this set of changes, I'm seeing double the performance for
String.gsub(String, String)
when the pattern fits inside the string (for single byte optimizable strings) and 4x - 5x when the pattern is too large. That last case might seem strange, but ifgsub
is being used to sanitize some text that may vary in size, it's quite possible for the sanitize pattern to be larger than the body it's applied against.It's a bit hard to nail down an absolute speed improvement due to the
gsub
process varying both on the receiver and the pattern sizes. For the out-of-bounds cases, we can avoid fetching either rope's byte array. The rest of the improvements are due to removing the large boundary.If you don't like the
ToRopeNode
, I can take another pass at that. I'm not entirely happy that it overlaps withRubyStringLibrary
, but I did want to@CreateCast
and just work with the ropes in the various specializations. Likewise, I can adjust the branch profiles as needed. They may not be needed at all.