-
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
TRegex splitting #2389
TRegex splitting #2389
Conversation
…one. The Ruby implementation resulted in too many AST nodes, which was preventing the method from splitting, which had a large negative impact on overall regex performance.
The `raw_bytes` node was used to get a Java `byte[]` out of a Rope as a polyglot object for hooking into Truffle Regex. Since the Truffle Regex interop is now done in Java, there's no need for this node.
One thing to note is there is some Java -> Ruby -> Java boxing of some data types. E.g., |
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.
One thing to note is there is some Java -> Ruby -> Java boxing of some data types. E.g.,
SelectEncodingNode
returns aRubyRegexp
, but in the end all we need is anEncoding
. I left most of them figuring EA would take care of them.
I think this is a good opportunity to simplify, and select_encoding is used nowhere else.
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.
Thank you, this looks great.
I'll address my own comments here, as a way to get familiar with the changed code.
PullRequest: truffleruby/2767
This is a port of
Truffle::RegexOperations.match_in_region_tregex
from Ruby to Java in order to reduce the number of AST nodes needed, which in turn allows for splitting. Being able to split leads to substantial performance improvements. Using the microbenchmarks from #2381, I have:Joni for all regexs:
Truffle Regex with Joni fallback:
This was run on a MacBook Pro i7 2.6 GHz with macOS 11.3.1.