What is it?
luje is an experimental (read: toy) Java virtual machine written in pure Lua. It works by compiling Java bytecode into Lua scripts on-the-fly and then running them using Mike Pall's LuaJIT 2. The result is an extremely fast but incredibly lightweight Java virtual machine which can outperform the server JIT used in OpenJDK in some situations.
Right now it excels at anything which involves tight loops and float or doubles in local variables --- see the LocalBench benchmark. It'll comfortably beat Hotspot (on amd64, or Zero on ARM) with those. However, it's not good at longs (although much better than it used to be). stored in hash tables, so accessing fields in an inner loop will tend to cause luje to slow down. It hasn't really had any testing with non-trivial benchmarks yet; if anyone has any recommendations, please email me. Still, given that the whole thing is less than 3000 lines of code the performance so far is damn good.
Consider these two carefully chosen unrepresentative microbenchmarks.
lib/com/cowlark/luje/LocalBench.java in the
distribution) performs some simple computations on local variables. FieldBench
lib/com/cowlark/luje/FieldBench.java) performs the same
computations, but the values are stored in fields and the computation is done
via a method call.
amd64: OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-1); OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
ARMv7: OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-5); OpenJDK Zero VM (build 22.0-b10, mixed mode)
There's plenty more optimisation that can be done --- laying out data structures in a way that's more friendly to the JIT would be good --- but it's already looking extremely promising. The memory footprint is a tiny fraction the size of IcedTea, too.
Currently it's in an extremely unfinished and fragile state. Not all bytecodes
are implemented (including the rather important
wide), and the
runtime library (stolen from Apache Harmony) has a number of things stubbed
out. There are many bugs. It's certainly not useful for real work yet, and may
not be at ever. See the bug tracker for
You might want to read the Frequently Asked Questions.
2013-10-16: Version 0.2.1 released. Bugfix for 0.2 --- there was a missing file.
2013-10-08: Version 0.2 released. Much better long performance. Bugfixes.
2013-10-06: Version 0.1 released.
2013-10-02: Placeholder website goes live.
Where can I get it?
Version 0.2.1 is available for download.
It's currently unreleased, but if you're desperate you can download an the latest version from the VCS. This is not guaranteed to work, or even to build.
Another way of getting the version under development is by checking out the source repository using the Fossil DVCS. Use the following commands:
mkdir luje cd luje fossil clone http://cowlark.com/luje luje.fossil fossil open luje.fossil
You will need LuaJIT 2; it doesn't work on stock Lua, or on LuaJIT 1.
How do I use it?
Download it, build the Java side of things with ant, and then run it with the supplied shell script. (As it's all just a small pile of Lua scripts, it doesn't need compiling itself.) Full instructions are in the README.
Who wrote it?
What's the license?
luje is distributable under the terms of the Simplified BSD License. It also contains code derived from the Apache Harmony project, which is available under the Apache 2.0 license.