-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Truffle ropes 2 #3619
Truffle ropes 2 #3619
Conversation
if (RubyGuards.isRubyString(string)) { | ||
return StringOperations.getByteListReadOnly(string).dup(); | ||
// TODO (nirvdrum 25-Jan-16) Should we flatten the rope to avoid caching a potentially deep rope tree? |
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.
But then you would lose Rope identity comparison, it's a trade-off.
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.
Indeed. Although we're still doing a full byte[] comparison if the ropes aren't identity equal. We can eliminate that, but I was just maintaining existing functionality for now. The flattening could also work in conjunction with a lookup table to ensure the same references, as well.
I read through the diff quickly, looks fine 😄 |
…alizing a byte[] if not necessary.
…atible encodings.
This prevents a lot of converting Ropes into ByteLists so they can be used by Symbols.
…h codes have already been calculated. This could help avoid a length byte walk.
We probably need something more robust to various attacks, but we definitely shouldn't be creating a temporary ByteList to get a hash code.
…filling each descendent's byte[] as well.
* Unified with the String#data method. * Used Rubinius::ByteArray and removed our Rubinius::StringData shim. * Cached value in String DynamicObject and invalidate on Rope update.
4e7a3a9
to
5a81cfa
Compare
Looks good to me. Can we have a final PR for all changes and a merge commit so it's clear when it went it? |
Yeah. This is already rebased on |
👍 |
@chrisseaton @pitr-ch @eregon This is the additional work I've done on ropes since the last pull request. I did it as a separate pull request against the branch you've already reviewed so you can see the new changes more easily.
The work here was primarily to improve performance over the original branch. The first one was basically just functionally complete. This PR has a larger emphasis on doing things more efficiently with ropes. There's still a lot more we can do, particularly in the area of regular expressions.
Notable highlights:
Rope#hashCode
andRope#equals
.