Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
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.
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
The video titled **Just-in-Time Compiling Ruby Regexps on TruffleRuby**, presented by Benoit Daloze and Josef Haider at RubyConf 2021, explores the advancements of TruffleRuby, focusing on its innovative approach to executing Ruby regular expressions (regex) at significantly enhanced speeds. TruffleRuby, which is a high-performance implementation of Ruby using the GraalVM Just-In-Time (JIT) compiler, aims to deliver fast performance while ensuring compatibility with Ruby 2.7 and supporting C extensions. Key points discussed in the video include: - **Regex Engine Background**: Initially, Ruby used the Onigmo regex engine, based on backtracking, which supports a wide variety of encodings. TruffleRuby started with Joni but faced limitations in performance due to the backtracking nature. - **Introduction of T-ReX**: To address these performance challenges, TruffleRuby adopted T-ReX, a new regex engine utilizing deterministic finite automata (DFA), thus allowing efficient just-in-time compilation of regex patterns into machine code. - **Mechanism of Finite State Machines**: The speakers explain the workings of finite state machines and how they can be effectively mapped to the core features of regular expressions like concatenation, disjunction, infinite quantifiers, and capture groups. - **Performance Improvements**: Benchmark comparisons show that T-ReX outperforms Joni and CRuby, with speed increases ranging from 25 to 40 times faster in micro-benchmarks. The enhanced mechanisms include optimized inlining of Ruby methods with regex logic specific to the pattern used, facilitating considerable performance boosts. - **Safety and Security**: An important advantage of T-ReX is its resilience against regular expression denial of service (ReDoS) attacks, as it matches patterns in linear time, eliminating the risk associated with backtracking engines. - **Future Enhancements**: The discussion also touches on future plans to enhance T-ReX, including support for previously unsupported features such as arbitrary counted quantifiers, but recognizes the complexities involved in certain features like back references and atomic groups. In conclusion, the talk emphasizes the effectiveness of finite state machines for regex matching over traditional backtracking methods, highlighting the seamless integration allowed by Truffle Ruby and T-ReX. This advancement allows developers to enjoy not only significant performance gains—from microbenchmarks showing 24 to 41 times faster processing but also a robust solution to common regex-related security vulnerabilities. The presenters encourage questions and further discussions on improvements and experiences with regex in Ruby development.
Suggest modifications
Cancel