Anybody keeping up with TruffleRuby?

twitter logo github logo ・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 built by Oracle Labs.

Getting started

There are three ways to install TruffleRuby:

  • Via GraalVM, which includes support for other languages such as JavaScript, R and Python and supports both the native and JVM configurations Inside GraalVM will then be a bin/ruby command that runs TruffleRuby We recommend that you use a Ruby manager to use TruffleRuby inside GraalVM.

  • Via your Ruby manager/installer (RVM, rbenv chruby, ruby-build, ruby-install). This contains only TruffleRuby, in the native configuration, making it a smaller download. It is meant for users just wanting a Ruby implementation and already using a Ruby manager.

  • Using the standalone distribution as a simple binary tarball. This distribution is also useful for testing TruffleRuby in CI. On TravisCI, you can simply use:

    language: ruby
    rvm:
      - truffleruby

You can use gem

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.

twitter logo DISCUSS (8)
markdown guide
 

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.

 

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.

 

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.

 

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.

 

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.

 

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

 

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

 

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

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

Classic DEV Post from Jul 17

What are you (still) not interested in learning?

I'm interested in hearing not only what you are *not* interested in learning. But if you answered the question last time, has anything changed?

Ben Halpern profile image
A Canadian software developer who thinks he’s funny. He/Him.