Escape Analysis in Java 6 Update 14 – Some Informal Benchmarks

Posted in Java by Dan on May 31st, 2009

Sun recently released update 14 of the Java 6 JDK and JRE.  As well as the usual collection of bug fixes, this release includes some experimental new features designed to improve the performance of the JVM (see the release notes).  One of these is Escape Analysis.

To see what kind of impact escape analysis might have on my applications, I decided to try it on a couple of my more CPU-intensive Java programs.  Escape analysis is turned off by default since it is still experimental.  It is enabled using the following command-line option:

-XX:+DoEscapeAnalysis

Benchmark 1

The first program I tested is a statistical simulation.  Basically it generates millions of random numbers (using Uncommons Maths naturally) and does a few calculations.

VM Switches: -server
95 seconds

VM Switches: -server -XX:+DoEscapeAnalysis
73 seconds

Performance improvement using Escape Analysis: 23%

Benchmark 2

The second program I tested is an implementation of non-negative matrix factorisation.

VM Switches: -server
22.6 seconds

VM Switches: -server -XX:+DoEscapeAnalysis
20.8 seconds

Performance improvement using Escape Analysis: 8%

Conclusions

These benchmarks are neither representative nor comprehensive.  Nevertheless, for certain types of program the addition of escape analysis appears to be another signficant step forward in JVM performance.

Upgrading Obsolete Ubuntu Systems

Posted in Linux by Dan on May 30th, 2009

Ubuntu 7.10 (Gutsy Gibbon) recently reached EOL (end-of-life). Presumably to discourage people from continuing to use a distro that is officially dead, the package repositories for an EOL release disappear from archive.ubuntu.com, which means that if you try to use apt-get to install or upgrade your software you will get 404 errors.

The recommended action for anyone still running 7.10 is to use the do-release-upgrade command to (relatively) painlessly upgrade to a newer, supported version of Ubuntu (remembering to take a backup first, just in case). The one little catch with this solution is that without access to the package repository, you won’t be able to install the upgrade tool if you don’t already have it.

Fortunately, the Gutsy repository hasn’t been removed completely, it’s just relocated to old-releases.ubuntu.com. So if you edit /etc/apt/sources.list and replace all occurrences of archive.ubuntu.com with old-releases.ubuntu.com, you will again be able to access the packages for 7.10. You should then install the update-manager-core package to enable the upgrade.

sudo vi /etc/apt/sources.list
sudo apt-get install update-manager-core

After doing this and before upgrading, it is important to revert the changes made to the sources.list file (i.e. change it back to using archive.ubuntu.com). This is because the distro upgrade will replace all references to ‘gutsy’ with ‘hardy’ (as in Hardy Heron, the Ubuntu 8.04 release) but will not change the repository addresses. Since Hardy is hosted at archive.ubuntu.com, leaving it as old-releases.ubuntu.com will cause the upgrade to fail.

sudo vi /etc/apt/sources.list
sudo do-release-upgrade

If all goes well you will end up with a fully functioning Ubuntu 8.04 system. Hardy Heron is the current LTS (Long Term Support) release. You have the option of a further upgrade to 9.04 (Jaunty Jackalope), but although it is a more recent release, it will reach EOL earlier because there is no long term support commitment for Jaunty. Jaunty will reach EOL in October 2010 whereas Hardy will be supported until April 2011 for desktops and April 2013 for servers.

SICP – The most divisive book in Computer Science?

Posted in Books by Dan on May 28th, 2009

Structure and Interpretation of Computer Programs (universally referred to as SICP) seems to be mentioned whenever people are discussing the great/classic/essential Computer Science books. It typically generates a mixed response. Somebody recently sent a copy (anonymously?) to Python creator Guido van Rossum, apparently as a comment on his supposed ignorance (incidentally, this is an incredibly arsey thing to do). It seems that SICP is a real love-it-or-hate-it kind of book. Depending on who you listen to, it’s either a mind-bending classic through which true enlightenment can be achieved, or it’s dull, obvious and poorly written. The distribution of the reviews for SICP on Amazon (UK) is striking:

Amazon SICP reviews

If you haven’t already read it, you can decide for yourself. The whole thing is available online. I didn’t get very far the one time I started to read it. I quickly got bored with the introductory stuff, but I intend to give it another go sometime. I’ve seen several people recommend the associated video lectures, which may be a better entry point.