4 ms·
I'm amazed gcc is slower than java. And it's more expressive than scala and f#? Something's gotta be wrong there..
by akkartik 17y ago
I'm amazed gcc is slower than java.
And it's more expressive than scala and f#? Something's gotta be wrong there..
- fauigerzigerk 17y agoYou need to look at how many data points each language implementation actually produces. gcc runs all programs whereas java steady state (the one that looks faster than gcc) lacks a lot of data points (i.e programs). As you can see in the diagram gcc's star is pulled towards the right by one data point (at least it looks like one). If java steady state ran all programs its star might shift to the right as well. Or it might not. It's just not comparable as it is. You need to look at the actual numbers instead of the diagrams. My own benchmarks that I run on our heavily algorithmic long running code consistently show Java about 10% to 20% slower than gcc (C++) and memory usage about twice that of the C++ implementation (excluding the JVM memory itself). C and C++ performance depends heavily on avoiding malloc/new. C/C++ code that gratuitously allocates and frees heap memory tends to be much slower than Java code.
- kingkongrevenge 17y agoA two line fix to compile in something like smartheap typically makes that memory allocation penalty go away. Not that it's hard to avoid unnecessary allocation/deallocation.