Raybench - Java (PLC pt.14)

Java, Java, Java... while having a pervasive presence in the world of programming, no body seems to like it very much (at least on my circle of acquaintances).

Appearing back in 1995 as a general purpose language, claiming multi platform compatibility, Java has gained a huge popularity. It has been used in projects of different sizes, spanning web servers to enterprise applications, as well as embedded systems.

Java is intended to work on a virtual machine (JVM), that compiles into it's own byte code format, in contrast to languages that compile to native binaries. Because of this, Java has a reputation of being slow, but... is it?

Results

Java 1.7.0_111, OpenJDK IcedTea 2.6.7, was used for running the tests.

Compile time

How fast does the compiler takes to generate the binary.

$ time javac javarb.java 

real    0m4.024s  
user    0m3.692s  
sys     0m0.296s  

Java compiles pretty fast as you can observe, faster than GCC.

Running Time

$ time java javarb 

real    2m36.949s  
user    2m34.344s  
sys     0m1.832s  

O_O!

Code Metrics

Line count: 287 code, 70 blank, 357 total.
File size:7722 bytes.

This implementation is almost as big as C, and also a little bit bigger than C#. Nothing unexpected here.

General Thoughts

Well, I wasn't foreseeing this. Java is known as a slow language by many people, but it turns to be not the case, at least on this benchmark; performing close to C level performance, which is very nice.

Maybe it's time to start taking Java more seriously for high performance computing.

Follow

You can follow the development of this project on GitHub: https://github.com/niofis/raybench