Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

FASTRUBY was Charles Oliver Nutter’s 2012 experiment in compiling Ruby code into Java source. Its Fibonacci-style test was reported as about 30% faster than JRuby with invokedynamic, but the result came from one local benchmark and an unfinished prototype—not a current performance guarantee or maintained product.

What FASTRUBY was

FASTRUBY was a small experimental Ruby-to-Java compiler described by Charles Oliver Nutter in a post dated September 17, 2012. Instead of producing a native executable, it translated a Ruby program into Java source and used a compact Java runtime to preserve important Ruby behaviors.

The experiment explored whether generated, statically structured Java code could execute Ruby-style method calls faster than JRuby’s then-new invokedynamic implementation. It was a proof of concept, not a finished language implementation, distribution, or commercial tool.

How the Ruby-to-Java translation worked

The generated classes

For the sample Ruby class, FASTRUBY generated a Hello.java file containing implementations of the Ruby methods. It also generated RObject.java, which declared stubs for every method name observed in the script.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall

Dynamic calls through Java virtual dispatch

Ruby calls could therefore be emitted as virtual calls against RObject. If the receiving class implemented the requested method, Java dispatch reached that implementation. If no implementation existed, the stub could raise an error. This design gave the generated code a Ruby-like dynamic method surface while using ordinary Java method calls.

The supporting runtime

A bundled RKernel runtime supplied Kernel-style operations such as puts, conversion helpers including toBoolean and toString, and singleton representations for nil and Boolean values. Other Ruby values were represented by runtime classes such as RFixnum for integers and RString for strings.

What “static compilation” meant in this experiment

FASTRUBY’s output was statically generated Java source, but the resulting program was not statically typed in the way a conventional Java application is. Method names and Ruby value behavior still depended on the runtime model and the generated stubs. The approach moved part of execution into Java methods without removing Ruby’s dynamic dispatch requirements.

That distinction matters: FASTRUBY was not a Ruby-to-native compiler, and it did not eliminate the runtime needed for Ruby objects, coercions, errors, and Kernel behavior.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What performance result did FASTRUBY report?

Nutter concluded that the prototype was “about 30% faster than JRuby with invokedynamic.” The comparison was for his Fibonacci-style test and should be read as the author’s result from one setup, not as an independently controlled benchmark or a guarantee for other Ruby programs.

Timing values shown in the original experiment

Run Elapsed time (milliseconds)
1 363
2 239
3 195
4 193
5 209
6 193
7 194
8 192
9 201
10 193

These are sample timings from repeated Fibonacci runs in Nutter’s local test environment. They are historical evidence of that experiment, not a reproducible baseline for current JVMs, Ruby versions, hardware, or workloads.

What limited the prototype?

No Fixnum-to-Bignum bounds check

The prototype did not check whether a Fixnum operation needed promotion to Bignum. That left integer-overflow handling incomplete for values outside the supported Fixnum range.

Extra integer allocations

FASTRUBY did not cache Fixnum objects in the way JRuby did at the time. Nutter noted that the generated Fibonacci recursion created three new RFixnum objects per recursion where JRuby would not, an overhead that worked against the compiler’s speed advantage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

No generated entry point

FASTRUBY did not yet generate a Java main method. Nutter used a separate Java runner to invoke the compiled class and perform the benchmark, so the prototype lacked the straightforward command-line packaging expected from a finished compiler.

Unspecified broader compatibility

The experiment covered a focused sample rather than a complete Ruby implementation. Its account does not establish broad compatibility with Ruby’s standard library, native extensions, metaprogramming patterns, or production applications.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What did Nutter propose next?

The post identified several possible directions:

  • Emit specialized methods for arithmetic instead of routing every operation through general runtime objects.
  • Allow Java type declarations to provide additional static information.
  • Implement Java interfaces directly from compiled Ruby classes.
  • Target Android by including only the code actually used together with a minimal runtime.

The available account does not establish that these ideas became a maintained compiler or a released product.

How should FASTRUBY be judged today?

FASTRUBY is best understood as a historical compiler experiment showing one way to combine generated Java methods with Ruby-compatible dynamic behavior. Its reported speed result is interesting because it suggested that a specialized translation could outperform JRuby with invokedynamic on a small recursive benchmark. Its missing numeric checks, extra object creation, absent entry point, and limited demonstrated scope show why that result was not equivalent to a production-ready Ruby implementation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If you encounter FASTRUBY in discussions of Ruby performance, describe it as a 2012 Java-source compilation prototype and attribute the roughly 30% figure to Nutter’s single test. There is no evidence in the source account that it remains a currently verified, maintained tool.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.