Running Groovy natively without the JVM

Two days ago I was hacking away at some Ruby scripts and thought it would be nice if I could write them in Groovy (not necessarily useful, just nice).

Of course, for small scripts that honour the UNIX philosophy, that would be a terrible idea. These scripts should start instantly and have minimal overheads.

What changes would be needed to allow Groovy to compete with languages like Perl, Python, TCL, Ruby or plain old shell scripts in this space?

* Better performance / reduced overheads (cpu, memory, start-up time).
* Simple install (src tarball, RPM, dpkg, windows installer, OS-X whatever).
* No JVM required.
* Ability to use Groovy to access less Javaish libraries (POSIXy style stuff, MFC, .NET).
* Ability to use Groovy (and Java) objects from other languages (C, C++, Perl, Python, Ruby, .NET, etc)

As an experiment, I’ve created a subproject of Groovy (groovy-native) that aims to address these issues.

Take a peek at where I’m going with this.

So far:

* Created a stripped down native runtime library (libgroovy.so).
* Compiled a .groovy file to a native executable (linked with libgroovy).
* Created a native C++ app that calls interops with Groovy objects.

  • Trackback are closed
  • Comments (5)
  1. That’s funny from a Python -> Jython perspective …
    You are going the exact opposite way :) I think it’s an excellent idea, but how will you make use of Groovy-Java integration without a JVM ? I mean – all these nifty SQL/via JDBC and GPath features, won’t you have to rewrite everything native ?

    • Joe Walnes
    • January 7th, 2004

    The idea is to nativify things that make sense.

    For some stuff it may make sense to compile from Java to native (e.g. GPath).

    For other stuff it may make sense to provide implementations that use alternative native library alternatives use less overheads than their Java equivalents (e.g. RegExps, XML, SQL).

    And some stuff will probably not make it into the native port (e.g. Ant, JMX, etc).

  2. native groovy

    Joe ‘s been doing some wacky stuff lately making a binary executable version of groovy or turning groovy scripts into executables.

  3. The most important thing a native Groovy will need is a high quality, extensive standard library. As far as I understand it, Groovy uses Java’s APIs for any real work.

    As a start, how about just compiling Groovy with GCC? Would that get you anywhere useful?

  4. Doh! Should read *everything* before I post. I see that you are using GCC.

Comments are closed.
%d bloggers like this: