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 476902
To view parent comment, click here.
To read all comments associated with this story, please click here.
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

Elv13 Member since:
2006-06-12

Read the last part of the paper.

(myself) Manual delete are faster as long as the destructor is simple. You can have a pseudo fast GC my deriving all objects from a GC class and use it to increment/decrement object reference count and use a templated, inlined accessor like function instead of = or override = manually for every class (to keep the object count). Then when the ref count = 0, then delete itself.

But this is not "safe" nor complete. Real time ref analysis is slow. Static/dynamic analysis also require to keep/manage a complete list of all memory allocation, this take management time, interpreter time (for VM based language) and a lot of memory. Al least, it how I see it.

Reply Parent Score: 2

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