I don’t think you will find anything. When it comes to optimization, Ruby and Java are actually very similar, the main point of pain for both is the boxed objects and the dynamic dispatch of a method that they both inherited from Smalltalk (directly Ruby, Java through Objective-C's main inspiration ). And Java virtual machines are simply the most advanced runtimes for dynamically distributed OO languages. For example, there may be some research for Scheme that is even faster, but when it comes to industrial-ready industrial implementations, Azul Zing , Oracle HotSpot , Oracle JRockit , IBM J9 and friends win hands down.
So, if the guys from Rubinius didn't come up with something that the Smalltalk / Java community didn't notice, you'll pretty much find yourself at the same performance at best.
Your best bet is not digital processing, but word processing. This is what pleases the legacy of Ruby Perl. Most regex mechanisms of Java implementations are not very efficient (although they are improving), while Onigmo is actually not bad (not as good as Perl, though). In addition, independent Ruby character-encoded strings prevent re-encoding of your string, whereas Java strings should always be encoded in UTF-16 and from UTF-16 if the input and output encodings are not UTF-16, which is unlikely. In Ruby, you need to transcode no more than once, even if your input and output encoding is different, you can set the internal encoding to be the same as input or output encoding, and therefore you only need to transcode during input or output, but not both .
There are examples, however, of Ruby competing with C, and since everyone knows and trades; that C is faster than Java, it certainly should mean that Ruby is faster than Java, right? Right?
[In fact, finding examples where Ruby outperforms C is probably simpler because dynamic optimizations such as speculative inline, polymorphic inline caching, adaptive optimizations, and the “unsafe” optimizations provided by dynamic de-optimizations do not exist in typical C implementations.]
In particular, the Rubinius Hash class , which is written in Ruby, is significantly slower than the YARV Hash class , which is written in C.
And a really exciting example: JRuby + Truffle + Graal + TruffleC can run YARV C extensions in the C interpreter on top of the JVM (!!!) faster than YARV can run C extensions initially:
- Very High Performance C-Extensions for JRuby + Truffle by Matthias Grimmer and Chris Seaton
- Dynamically created languages in a modular way: support for C extensions for dynamic languages by Matthias Grimmer, Chris Seaton, Thomas Worthinger, Hanspeter Messenbock, in the materials of the 14th International Conference on Modularity, 2015
- High-performance multilingual interoperability in multilingual mode by Matthias Grimmer, Chris Seaton, Roland Schatz, Thomas Worthinger, Hanspeter Mössenbock, in the materials of the 11th Symposium on Dynamic Languages (DLS)
[Of course, this last example is actually an example of the strength of Truffle and Graal , i.e. two Java technologies, more than Ruby's power example.]