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

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:

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

f0dder Member since:

How do you handle cyclic references with that approach? (root-tracing GC helps a lot in handling those).

How do you suspect it performs in heavily threaded code? (you need mutexing both on the refcount and on your heap).

GC isn't the end-all-be-all, but for a lot of scenarios it works very well - and it's going to be a lot of effort emulating in C++, and won't be a full solution as long as you need to interface with legacy code.

Don't get me wrong, I'm a sucker for C++ and RAII, but it's not the only-and-best solution for all scenarios.

Reply Parent Score: 2