DEV Community

Ben Halpern
Ben Halpern

Posted on

Anybody keeping up with TruffleRuby?

GitHub logo oracle / truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.

TruffleRuby logo

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

Getting Started

TruffleRuby comes in two distributions:

  • Native Standalone: This only contains TruffleRuby in the Native configuration.
  • JVM Standalone: This only contains TruffleRuby in the JVM configuration This includes support for other languages such as Java, JavaScript, Python and WebAssembly.

You can install either of those:

  • Via your Ruby manager/installer (RVM, rbenv, chruby, asdf, ruby-build, ruby-install). We recommend trying TruffleRuby dev builds which contain the latest fixes and improvements (replace VERSION by dev).

Native Standalone:

RVM:    $ rvm install truffleruby # or truffleruby-head
rbenv:  $ rbenv install truffleruby-VERSION
asdf:   $ asdf install ruby truffleruby-VERSION
chruby: $ ruby-install truffleruby
        $ ruby-build truffleruby-VERSION ~/.rubies/truffleruby-VERSION
Enter fullscreen mode Exit fullscreen mode

JVM Standalone:

rbenv:  $ rbenv install truffleruby+graalvm-VERSION
asdf:   $ asdf install ruby truffleruby+graalvm-VERSION
chruby: $ ruby-install truffleruby-graalvm
        $ ruby-build truffleruby+graalvm-VERSION ~/.rubies/truffleruby+graalvm-VERSION
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.

Top comments (9)

Collapse
 
ksec profile image
ksec

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 twitter.com/chrisgseaton is now working in Shopify, although he did said he is not trying to get Rails inside Shopify to be running on TuffleRuby yet.

Collapse
 
rhymes profile image
rhymes

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.

Collapse
 
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.

Collapse
 
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: youtube.com/watch?v=KA5NqfikoQ0

Collapse
 
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.

Collapse
 
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.

Collapse
 
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: youtu.be/TQMKPRc6cbE

Collapse
 
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.

Collapse
 
leob profile image
leob • Edited

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

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