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?
Java 1.7.0_111, OpenJDK IcedTea 2.6.7, was used for running the tests.
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.
$ time java javarb real 2m36.949s user 2m34.344s sys 0m1.832s
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.
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.
You can follow the development of this project on GitHub: https://github.com/niofis/raybench