Linked by ebasconp on Fri 10th Jun 2011 22:22 UTC
Benchmarks "Google has released a research paper that suggests C++ is the best-performing programming language in the market. The internet giant implemented a compact algorithm in four languages - C++, Java, Scala and its own programming language Go - and then benchmarked results to find 'factors of difference'."
Thread beginning with comment 476856
To read all comments associated with this story, please click here.
Results are Implementation dependent
by Alfman on Fri 10th Jun 2011 22:38 UTC
Alfman
Member since:
2011-01-28

I didn't see anything about which compilers they chose to compare.

Performance characteristics not the result of language syntax so much as the implementation of the compilers and supporting libraries. Google should have known this from the get go, so why didn't they compare implementations?

The significant variation in performance between C/C++ compilers clearly prove (as if any proof was needed) that compiler implementations do matter.

Another point is that some language implementations (eiffel) compile down to C and then are compiled/optimized by the C compiler.

The question of which language syntax performs better is meaningless.

Reply Score: 3

Valhalla Member since:
2006-01-24


Performance characteristics not the result of language syntax so much as the implementation of the compilers and supporting libraries.

Certain language characteristics have obvious performance consequences, for instance java, scala, go are all garbage collected which certainly comes with a performance penalty.


Another point is that some language implementations (eiffel) compile down to C and then are compiled/optimized by the C compiler.

Eiffel wasn't measured here was it? Nor was any other language (I know of Vala) which compiles to C?

Either way, I doubt there was any news to anyone that C++ was faster than Java, Scala and Go. As for the compilers of these languages, certainly Go has a very immature compiler suite given it's young age and it still being heavily in development, Gccgo (which relies on GCC's backend for code optimization) is said by the Go devs to produce much faster code than the official compilers.

Reply Parent Score: 5

dorin.lazar Member since:
2006-12-15

"
Performance characteristics not the result of language syntax so much as the implementation of the compilers and supporting libraries.

Certain language characteristics have obvious performance consequences, for instance java, scala, go are all garbage collected which certainly comes with a performance penalty.
"

I doubt that those exact features were put to test - garbage collection has nothing to do with this paper - and I doubt that it had anything to do with memory allocation. As a side note, I found that garbage collection does work better than manual memory management in memory-intensive programs.

Reply Parent Score: 0

Alfman Member since:
2011-01-28

Valhalla,

"Certain language characteristics have obvious performance consequences, for instance java, scala, go are all garbage collected which certainly comes with a performance penalty"

That's an assumption, which may or may not be true in practice.

Generational garbage collection algorithms can provide excellent data locality. C/C++ objects are generally forced to live out their lives at a fixed address, which is often not ideal after address space becomes fragmented.

Malloc/Free are more expensive than certain garbage collection algorithms such as semi-space collectors, which are absolutely trivial.

The tradeoffs are too complex to make absolute statements about which is better. I wouldn't be comfortable saying which is better without benchmarking them on a specific project.

The following link advocates garbage collection over malloc/free for performance reasons (although I think their conclusions are biased and overgeneralised)

http://www.ibm.com/developerworks/java/library/j-jtp09275/index.htm...


All this said, I personally prefer to control new/delete myself.


"Eiffel wasn't measured here was it? Nor was any other language (I know of Vala) which compiles to C?"

If we compare modern languages which are on more equal footing feature-wise, then which is faster: perl or ruby or python?

I'm saying that it doesn't make sense to compare the *language* (as google claims to have done), one has to compare the *implementation*.

Reply Parent Score: 4

Carewolf Member since:
2005-09-08

Technically garbage-collected languages should be faster but just use more memory (faster as long as the extra memory is available). In practice though this is almost never the case, but you can make many examples where Java runs faster than a C++ program, because they have no "inline" overhead of memory management.

Reply Parent Score: 2