What's the difference between Duby and Juby and why would I need either of them?

java, jruby, ruby

Solution

Mirah (formerly Duby) exists, because static typing can result in dramatically improved performance with Java/Hotspot. Surinx (formerly Juby) is the same thing, except that it also takes advantage of a new performance feature that is coming in JDK7 to enhance performance even further.

The performance feature is commonly called "invokedynamic", and a good explanation is available on Nutter's blog as well.

Problem

According to Charles Nutter, Duby is a static-typed language with Ruby's syntax and Java's type system. Duby supports all Ruby's literals, uses local type inference (only argument types must be declared), and runs as fast as Java (because it produces nearly identical bytecode). But with the advent of invokedynamic, Duby needed a playmate. 1. What's invokedynamic and why does Duby "need a playmate"? Juby, on the other hand, is intended to be basically like Duby, in that it uses Java's types and Ruby's syntax. But it takes advantage of the new invokedynamic opcode to be 100% dynamic. Juby is a dynamic Duby, or perhaps a dynamic Java with Ruby syntax. It's not hard to comprehend. Actually it is hard to comprehend. 2. Could someone elaborate a little bit more on what this distinction is about? 3. Why do we need (need!) another Ruby-related language? Or, rather, two more Ruby-related languages?

Original source