Java Compilers

Contestants
The Java compilers used where:

  • IBM - jikes.exe version 1.17
  • Borland - bcj.exe version 1.4.002 (JBuilder 7 + 8)
  • Borland - bcj.exe version 1.4.001 (JBuilder 6)
  • Sun Microsystems - javac.exe (Java SDK version 1.4.2)
  • Sun Microsystems - javac.exe (Java SDK version 1.4.1)
  • Sun Microsystems - javac.exe (Java SDK version 1.3.1)

Test bench

  • Abit KT7, AMD Duron 1GHz, 320MB RAM, Seagate IV 40GB Harddrive
  • Windows 2000, Service Pack 2

The following Java class was used for time measurements:

/*                         hjembaek.com                          */

import java.lang.*;
import java.io.*;

public class Execute {
    private static long start;

    /**
     * Compilation may be started using a batch file as args.
     */
    public static void main(String[] args) {
        Runtime rt = Runtime.getRuntime();

        try {
            start = System.currentTimeMillis();
            Process child = rt.exec(args);
            child.waitFor();
            System.out.println(
            (System.currentTimeMillis()-start));
        }
        catch (IOException e) {
            System.err.println("IOException starting process!");
        }
        catch (InterruptedException e) {
            System.err.println("Interrupted waiting for process");
        }
    }
}

The compilers where started using the following batch scripts:

runjavac131.cmd
C:\Temp\compilers\j2sdk-se\1.3.1\bin\javac -d ..\classes *.java

runjavac141.cmd
C:\Temp\compilers\j2sdk-se\1.4.1\bin\javac -d ..\classes *.java

runjavac142.cmd
C:\Temp\compilers\j2sdk-se\1.4.2\bin\javac -d ..\classes *.java

runbcj7.cmd
C:\JBuilder7\bin\bcj -quiet -d ..\classes *.java

runbcj6.cmd
C:\JBuilder6\bin\bcj -quiet -d ..\classes *.java

runjikes.cmd
jikes -d ..\classes *.java

Each script was run once and subsequently 10 times. The first run is ignored because it is always a lot slower - as each compiler needs to get loaded in memory first. Afterwards - I speculate - it is cached by the CPU and does not obscure the results. Each script compiles 69 files placed in the same directory - (neither class is part of a sub package). The accumulated time for 10 test runs for each contestant is shown in the chart below.

Test results
Well, the test results are kind of obvious ...

Conclusion
If you wan't to save your precious time - use jikes where ever possible for your projects.
To all IDE developers out there - please make way for easy integration with jikes.

If you have any suggestions or comments regarding this test - mail me.

 

July 2003

Michael Hjembæk