Run your Ruby code faster on GraalVM's Ruby implementation, TruffleRuby
Running Ruby code faster
TruffleRuby is the fastest Ruby implementation for many CPU-intensive benchmarks
Executing Ruby code in parallel
TruffleRuby runs Ruby Threads in parallel, it has no global interpreter lock for Ruby code
Supporting C extensions
Many C extensions work out of the box, including database drivers
Provided by the GraalVM Polyglot API
Maintaining high compatibility with the standard Ruby
TruffleRuby aims to be fully compatible with the standard Ruby runtime (MRI/CRuby) along with extra functionality provided by JRuby
Providing tooling such as debuggers and monitoring
The tooling support includes a profiler, debugger, VisualVM, and more, and works across languages
Faster Ruby with TruffleRuby and GraalVM
TruffleRuby JVM CE is 4.2x faster than CRuby 3.0 and TruffleRuby JVM EE is 8.2x faster than CRuby 3.0
TruffleRuby JVM CE is 7.3x faster than CRuby 3.0 and TruffleRuby JVM EE is 10.6x faster than CRuby 3.0
TruffleRuby is able to run a key production Ruby application almost entirely unmodified from the standard Ruby configuration at Shopify, making it the only realistic option for migrating to a Ruby implementation with genuine potential for seriously increasing the performance and tooling of Ruby.
require 'sinatra' require 'some-c-extension' get '/' do CExtensions.work! end
Run your existing code unchanged, including native extensions
TruffleRuby runs Rails and is the only implementation besides CRuby to pass all RubyGems tests.
array = Java.type('int').new(4) array = 42 p array
Accessing Java from Ruby
Reuse any JVM library.
$ ruby --cpusampler app.rb Name | Total Time |Opt%|| Self Time |Opt% ---------------------------------------------------------------- Optcarrot::PPU#main_loop |3372ms 64.5%| 98%||1991ms 38.1%| 99% Optcarrot::PPU#render_pixel| 309ms 5.9%| 80%|| 309ms 5.9%| 80% $ ruby --inspect app.rb Debugger listening on ws://127.0.0.1:9229/... For help, see: https://www.graalvm.org/docs/tools/chrome-debugger E.g. in Chrome open: devtools://devtools/bundled/js_app.html?ws=127.0.0.1:9229/...
Includes a Built-in Sampling Profiler and Debugger
As well as VisualVM, Flamegraphs and more.
$ ruby -ropen-uri -e 'URI.open("https://expired.badssl.com/", &:read)' cext.rb:1096:in `rb_exc_raise': certificate has expired (OpenSSL::SSL::SSLError) from openssl/ossl.c:300:in `ossl_raise' from openssl/ossl_ssl.c:1697:in `ossl_start_ssl' from openssl/ossl_ssl.c:1755:in `ossl_ssl_connect_nonblock' from net/protocol.rb:44:in `ssl_socket_connect' from net/http.rb:1021:in `connect' from ... from -e:1:in `main'