Wednesday, August 26, 2009

Introducing Surinx

In June of this year, I spent a few hours formulating a dynamic cousin to Duby. Duby, if you don't remember, 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.

Enter "Juby". Juby 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.

But the name was a problem. Juby sounds like "Jewbie", a pejorative term for a Jewish person. So I sent out a call for names to the Twitterverse, ultimately ending up with far more names than I could choose from.

The name I have chosen, Surinx, has a simple story attached. You see, when James Gosling created Java, he originally named it "Oak", after the tree outside his window. So I followed his lead; the tree (a bush, really) outside my window is a lilac, Syringa vulgaris. The genus "Syringa" is derived from New Latin, based on a Greek word "surinx" meaning "shepherd's pipe" from the use of the Syringa plant's hollow stems to make pipes. Perhaps Surinx is building on the "hollow stem" of the JVM to produce something you can smoke (other dynamic languages) with. Combined with its cousin "Duby", we have quite a pair.

And in other news, the simple Surinx implementation of "fib" below (identical to Ruby) manages to run fib(40) in only 7 seconds on current MLVM (OpenJDK7 + invokedynamic and other tidbits), a five-fold improvement over JRuby's fastest mode (jruby --fast).

def fib(a)
if a < 2
fib(a - 1) + fib(a - 2)

Given that JRuby has started to support invokedynamic, the solid performance of Surinx bodes very well for JRuby's future.

Please welcome Surinx to your language repertoire!


  1. >The genus "Syringa" is derived from New Latin, based on a Greek word "surinx" meaning "shepherd's pipe"

    I initially read that as "shepherd's pie". Which would have just been weird.

  2. Nimrod: At the moment, using fully-boxed math, Surinx is only about 1.75x slower than Java or Duby also doing fully-boxed math. It's certainly going to be a lot slower than Java or Duby doing primitive math, but I think I can narrow that gap as well.

  3. Are Surinx or Duby possible contenders for Android development? As in, would it be possible for the Android bytecode translator to work with compiled Surinx/Duby jars?

  4. Charles: Excellent. I shall investigate Duby and hope that Google update Dalvik to work with JDK7.

  5. On the subject of names, "Duby" is more or less how you would pronounce the plural of "oak" in Russian (s. "дуб", pl. "дубы"). For whatever that's worth.

  6. Noel: Oh, that's just perfect :) Thank you for the information!

  7. I'm fairly sure that the shepherd's pipes were meant for playing music on. But the metaphor would still work -- Surinx as the hollow reed upon which many tunes can be played.

  8. I assume the object passed into "fib" in your example is a java integer?