DEV Community


Anybody keeping up with TruffleRuby?

Ben Halpern
A Canadian software developer who thinks he’s funny. He/Him.
・1 min read

GitHub logo oracle / truffleruby

A high performance implementation of the Ruby programming language. Built on the GraalVM by Oracle Labs.

TruffleRuby logo

TruffleRuby is the GraalVM high-performance implementation of the Ruby programming language.

Getting Started

There are four ways to install TruffleRuby releases and nightly builds:

We recommend trying TruffleRuby nightly builds which contain the latest fixes and improvements:

RVM:    $ rvm install truffleruby-head
Enter fullscreen mode Exit fullscreen mode

TruffleRuby aims to:
Run idiomatic Ruby code faster
Run Ruby code in parallel
Boot Ruby applications in less time
Execute C extensions in a managed environment
Add fast and low-overhead interoperability with languages like Java, JavaScript, Python and R
Provide new tooling such as debuggers and monitoring
All while maintaining very high compatibility with the standard implementation of Ruby

It's such an interesting project in Ruby world. I'm curious if anybody is keeping up with it and might have some "latest opinions" on how close it is to being practical to use in production and what your general thoughts are on the project.

Discussion (9)

ksec profile image

To those thinking Ruby JIT will be as fast, GraalVM and Truffle Ruby is literally hundreds of million dollar investment from Oracle over the past few years and more. I seriously doubt Ruby JIT will be anywhere close, and it is not a fair comparison anyway.

TruffleRuby has been aiming to run Rails for two years now, so it is close, but like any project the last 20% bits and pieces tends to take as much time as the first 80%.

They are trying to be a drop in replacement for MRI, with Sulong you can execute C, and other programming languages ( Including Javascript ) that can be transformed to LLVM bitcode on GraalVM. Unfortunately C extensions are hard to get right. So they had to even go and fix the C extension themselves.

I think they do need a bit more help from the Rails communities, unfortunately it seems everyone is avoiding anything from Oracle like plague. While Oracle might not be a companies to trust, they have been a very decent Java Stewards for many years now, and there is nothing stopping you from forking the entire project which is open sources.

Chris Seaton is now working in Shopify, although he did said he is not trying to get Rails inside Shopify to be running on TuffleRuby yet.

rhymes profile image

I'm not really tracking what TruffleRuby is doing in the day to day but it's an interesting project.

I wonder if, with the work around Ruby 3x3 and Ruby's JIT, it will be still as interesting for the late adopters and companies that don't want to deal with possible incompatibilies with the regulary CRuby ecosystem. We'll see.

There's definitely a need there, especially with long running processes like Rails apps.

Run idiomatic Ruby code faster

Yes! I guess it's also the 3x3 + JIT goal, though AOT compilation and the creation of a binary sounds sweeet and TruffleRuby uses a different technique.

According to Parallel and Thread-Safe Ruby at High-Speed with TruffleRuby is a lot faster in benchmarks. I want to see it with a Rails app though :)

Run Ruby code in parallel

Since it doesn't use CRuby, it doesn't have the GIL, so threads in memory can run in parallel. Should indirectly create an ecosystem of libs to do numerical computation and derivatives. Not sure how much it would benefit I/O bound frameworks like Rails+Puma or Sidekiq. We'll see :D

Boot Ruby applications in less time

Yeah! Rails startup is slow, even with bootstrap.

Execute C extensions in a managed environment
Add fast and low-overhead interoperability with languages like Java, JavaScript, Python and R

This is probably the most interesting part to me.
Someone said WebAssembly :D ?

Very interesting project indeed.

databasesponge profile image
MetaDave 🇪🇺

As a long time Oracle practitioner, I find it very intriguing that they're engaged with this. They've never been very Ruby-ish as an organisation, so it's interesting to speculate on their strategy in supporting this.

There's a lot of really smart technical people at Oracle though, so I have high hopes.

adamantish profile image
Adam Misrahi

Interested in where you're getting the hundreds of millions of dollars investment figure. The impression given from this is that it's a fairly small (if well paid) team:

jgaskins profile image
Jamie Gaskins

I've run a few things on it to see if its performance claims are real. They really are. It's terrifyingly fast for some things — almost as fast as Crystal for the same benchmarks.

I'd love to see a web service run on it to see what the performance looks like in a real-world app. Unfortunately, it doesn't quite seem to be ready for Rails, but I bet you could run Roda or Sinatra just fine.

katafrakt profile image
Paweł Świątkowski

It is definitely close to be production-ready. And it is probably single most exciting thing happening in Ruby. I can't wait to try it out in production.

dixpac profile image
Dino • Edited

I try to keep up :) I think it could be a future of Ruby especially now when Shopify invested in truffle-ruby. It is not great running Rails yet, but that could change. For me it is a breath of "fresh" air in the ruby ecosystem.

Also, I think that Oracle vision with truffle and GraalVM is extremley interesting, I found this video a great start if you want to lean more:

awwsmm profile image
Andrew (he/him)

I know the Truffle languages are built for GraalVM, a new polyglot Java Virtual Machine. It's pretty sweet.

leob profile image
leob • Edited

First time I hear about it ... :-)

So is this sort of a JRuby? (GraalVM is a Java VM/JDK)