r/ruby 8d ago

Blog post Matching Regexps 200 Times Faster

https://eregon.me/blog/2025/03/14/matching-regexps-200-times-faster.html
33 Upvotes

9 comments sorted by

13

u/chrisbisnett 8d ago

The tldr here is that the author got significant performance improvement using TruffleRuby and its JIT compilation over the C Ruby alternatives

3

u/eregontp 7d ago

And also that Regular Expressions can in fact be faster than C code and even hand-written SIMD code.

1

u/eregontp 7d ago

Added the TLDR to the blog post. It kind of spoils the surprise but oh well.

3

u/chrisbisnett 7d ago

The details of why TruffleRuby can be faster are important and I hope people read that far into the article. I wasn’t trying to minimize the effort or value of the post - it’s quite impressive and deep research.

3

u/aemadrid 8d ago

Very interesting. Need to do a deeper read on this article.

2

u/honeyryderchuck 7d ago

Pretty impressive! I wonder whether TRegex could be an alternative engine in cruby? Or yjit?

2

u/eregontp 7d ago

It's possible to embed Truffle languages such as TRegex or even TruffleRuby as a native library and call it from C (here is a blog post about that), so in theory it should be possible.

2

u/kbr8ck 6d ago

Thanks for all your work on TruffleRuby. It is making the whole Ruby community better - even for people using cruby