I have this results from a speed test I wrote in Java:
Java
real 0m20.626s
user 0m20.257s
sys 0m0.244s
GCJ
real 3m10.567s
user 3m5.168s
sys 0m0.676s
So, what is the purpose of GCJ then? With this results I'm sure I'm not going to compile it with GCJ!
I tested this on Linux, are the results in Windows maybe better than that?
This was the code from the application:
public static void main(String[] args) {
String str = "";
System.out.println("Start!!!");
for (long i = 0; i < 5000000L; i++) {
Math.sqrt((double) i);
Math.pow((double) i, 2.56);
long j = i * 745L;
String string = new String(String.valueOf(i));
string = string.concat(" kaka pipi"); // "Kaka pipi" is a kind of childly call in Dutch.
string = new String(string.toUpperCase());
if (i % 300 == 0) {
str = "";
} else {
str += Long.toHexString(i);
}
}
System.out.println("Stop!!!");
}
I compiled with GCJ like this:
gcj -c -g -O Main.java
gcj --main=speedtest.Main -o Exec Main.o
And ran like this:
time ./Exec // For GCJ
time java -jar SpeedTest.jar // For Java