Ruby Video
Talks
Speakers
Events
Topics
Leaderboard
Sign in
Talks
Speakers
Events
Topics
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Benoit Daloze @eregon Josef Haider @djoooooe TruffleRuby together with Truffle Regex can now execute Ruby Regexps up to 40 times faster than CRuby! This is possible by just-in-time compiling Ruby Regexps to machine code by using Truffle Regex, a Truffle language for regular expressions. Truffle Regex uses finite-state machines, a much faster alternative to backtracking regexp engines. Because of the unique capability of GraalVM to inline across languages, the Ruby code and the Regexp are optimized and compiled together for ultimate performance. RubyKaigi Takeout: https://rubykaigi.org/2021-takeout/presentations/eregontp.html
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the talk titled "Just-in-Time Compiling Ruby Regexps on TruffleRuby" presented by Benoit Daloze and Josef Haider at RubyKaigi Takeout 2021, the speakers discuss the advancements made in Ruby regular expressions using TruffleRuby, a high-performance Ruby implementation that leverages the GraalVM JIT compiler. The main focus is on the development of a new regular expression engine known as T-regex that utilizes finite-state machines, significantly improving performance compared to traditional backtracking regex engines like Onigmo. **Key Points Discussed:** - **Introduction to TruffleRuby and T-regex:** - TruffleRuby provides full compatibility with Ruby 2.7 while optimizing performance using the GraalVM JIT compiler. - T-regex is a bespoke regex engine designed to operate efficiently within the Truffle framework. - **Differences in Regex Engine Design:** - Traditional engines (like Onigmo) use backtracking, which can lead to inefficiencies. - T-regex employs deterministic finite automata, offering linear time complexity in regex matching. - **Features and Functionalities of T-regex:** - Supports concatenation, disjunction, infinite quantifiers, and capture groups. - Partial support for counted quantifiers and anchors. - Currently lacks support for backreferences, recursive calls, and negative lookarounds. - **Performance Improvement Demonstrations:** - Benchmark tests showcased TruffleRuby’s regex matching speed being 25 to 40 times faster than CRuby, with T-regex proving superior in regex-heavy workloads. - Use cases exemplified include the Liquid templating gem and the Browser Sniffer gem, which displayed significant performance enhancements when utilizing T-regex. - **Security Considerations:** - T-regex addresses ReDoS vulnerabilities associated with backtracking engines, ensuring linear-time matching and providing fallback to Onigmo only when necessary. **Conclusions and Takeaways:** - The implementation of T-regex represents a significant leap in the efficiency and safety of regex processing in Ruby, allowing for safer, faster, and more optimized application performance. - Ongoing collaborations and enhancements from contributors to the TruffleRuby and T-regex teams highlight the commitment to continuous improvement in Ruby's regex capabilities, setting a new standard for performance within the Ruby ecosystem. The presenters invite further discussion and queries from the audience regarding this advancement in Ruby functionality.
Suggest modifications
Cancel