How do you make Java fast? Answer: Go down the pub!

It all started back in 2008, I'd been looking at what the Software Bill-of-Materials would be for an ARM-based Netbook. I'm a great fan of JEOS (Just-Enough-OS) to support the end users software needs but even taking a JEOS approach the list of software that we had to enable was quite daunting. Back then, the Cloud as a platform for desktop apps like word processing hadn't quite taken shape. I had converted my family over to Google Docs but I wasn't sure if the rest of the world would be quite as ready to make that move when ARM-based devices became available. Open Office was quite a popular office suite in the Western world, however in Asia a small company called Haansoft (now Hancom, Inc.) were making headway with an office suite called ThinkFree Office that was small, lightweight and could run across multiple device form factors. The one minor problem was that ThinkFree Office was written entirely in Java Standard Edition (Java SE) and not in C/C++.

Further investigation showed that Java SE was, at the time, a key software platform for Web 2.0. Even today several popular browser plug-ins are written in Java such as Facebook's photo uploader and some of Yahoo's online games.

Luckily, Java SE was no longer a proprietary technology and had been set free by Sun as the Open Java Development Kit (OpenJDK) under GNU Public License (GPL). This meant that we were no longer reliant on one company to make Java available on ARM but could work with the open source community to make it happen.

As it turned out, by early summer 2008 members of the open source community at Red Hat were already hard at work porting OpenJDK to ARM. This port used the highly portable Zero Java byte-code interpreter.  By mid-July the initial ARM port had been completed and was scheduled to be available in the upcoming Debian 5.0 "Lenny" distribution. This was exceedingly good news since Debian forms the basis of almost all of the key Linux distributions including Xandros and Ubuntu, and by late summer Matthias Klose of Canonical (who create the Ubuntu distribution) was building and testing OpenJDK on ARM for the future "Jaunty" release of Ubuntu on ARM.

Job done? Not quite! Having a full free Java SE platform in the upcoming release of Debian and its derivative distros was great, but it ran really, really SLOW! The Zero Interpreter got its name because it is a zero processor architecture specific implementation- no optimizations for the processor, no fast assembly language loops and no JIT! In summary, the Zero interpreter contains nothing that in anyway detracts from its high degree of portability (which was why OpenJDK moved onto the ARM so fast). So, while we had a full Java SE platform on ARM, we didn't really have a practical platform for running real Java applications like ThinkFree Office.

The next thing I did was fly to Cambridge, England and go down the pub with a couple of my mates- Andrew Haley who is the Technical Lead for Open Source Java at Red Ha  and Edward Nevill who is an expert at writing Interpreters and JITs as well being one of the designers of the Thumb instruction set. After of couple of pints we hatched a plan: OpenJDK on ARM still needed a little work to get it building for the Jaunty release of Ubuntu that was scheduled for April 2009. However the real question was could we make it go fast? Back then the Open Source JITs that targeted ARM weren't quite ready for prime time so it looked like the best shot at getting performance up was for Ed to rewrite the Zero interpreter loop in ARM assembler.

Anonymous