Wednesday, May 07, 2008

jSuneido ?

As I work on multi-threading Suneido I wonder if I shouldn't be shifting direction.

Does it really make sense to implement your own VM these days? Wouldn't it make more sense to re-implement Suneido on top of an existing VM such as Java?

For example, jRuby (Ruby re-implemented on the Java VM) in some cases outperforms the original C version of Ruby.

And Groovy also demonstrates that it is possible to implement a highly dynamic language on top of the Java VM.

The JVM would handle low level issues like garbage collection and JIT and multi-threading and 64 bit. (Although you'd still have to deal with higher level multi-threading issues.)

It could provide access to Java libraries so we didn't have to continually "re-invent the wheel".

It would not solve the current issue of a non-portable Windows UI. As with my current project, it could be server only to start with.

It would allow portability to everywhere that the JVM is available.

I'd have to not only learn Java, but also learn JVM issues that a normal Java programmer doesn't have to worry about. That's a little intimidating.

Of course, the other big question is why not just use an existing language/database? The big reason now, is that we have a big (to us) application written with Suneido's language and database. The thought of re-writing or porting it all to another platform is way too scary.

Moving to something like the JVM that allowed interoperability with other JVM based languages (and other databases) might actually allow us to incrementally move to another language if we chose to.

Obviously, this wouldn't be a minor decision, but it is food for thought.


Larry Reid said...

Brilliant idea. I've been trying to think of how I could say, "I know what you're doing is fun, and I know you need to support Suneido for Axon's software, but there's got to be a better way" -- but I couldn't think of what the better way was. I think this is it.

The only concern I have is the performance of Java. I know I'm running a program written in Java because it feels like I'm running in a swimming pool. Everything happens in slow motion. Maybe it's just me, but I'm sure that if I experience it this way, others must, too.

andrew said...

Yeah, I also find many Java programs seem slow. I think it's better than it used to be, either because of improvements in hardware, or improvements in the JVM. And I find many non-Java programs annoyingly slow as well! It's frustrating that (some) software seems to get slower more than hardware gets faster.

I would hope that with all the resources behind them, JVM's would be faster than my homebrew VM with only one part time person behind it.

One issue is the "impedance" mismatch between a dynamic language and the more static JVM. But the other dynamic languages implemented on top of the JVM demonstrate that it's possible. And there are several proposed improvements to the JVM to handle dynamic languages more easily.