4 ms·
There are two glaring problems with this paper: 1. The algorithm is just a bunch of arrays and loops in one giant block. This is the easiest possible case for
by georgewfraser 12y ago
There are two glaring problems with this paper:
1. The algorithm is just a bunch of arrays and loops in one giant block. This is the easiest possible case for compilers that optimize through specialization. Even a bad specializing compiler will be good at this but will blow up when faced with a big piece of code with lots of functions and data structures.
2. The runtimes are only ~2s, which is not long enough for the JIT-compiled languages to "warm up". I suspect Java in particular would have had the exact same runtime after warming up, because in an easy example like this Hotspot will generate the exact same instructions as the C program.
EDIT: I stand corrected. I downloaded his examples off Github and ran them the same way as the paper. I get 1.87s for C, and for Java... also exactly 1.87s.
- Alupis 12y ago> EDIT: I stand corrected. I downloaded his examples off Github and ran them the same way as the paper. I get 1.87s for C, and for Java... also exactly 1.87s. Your code probably got JIT'ed... which essentially makes your java code into native C... So... it's no surprise they perform around or exactly the same (given the JVM is allowed time to warm up, discover "hot spots", and then perform the JITing)
- georgewfraser 12y agoTrue though oddly I compiled and ran them exactly the same way he described in the paper -- one time through, no warm-up time.