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

"GC performs better than manual memory management only in a small subset of scenarios.


GC typically performs better in situations where there is a lot of fairly small amounts of memory allocation and deallocation happening in a relatively short period of time. The typical (and usually recommended) practice in C or C++, of course, is to free memory as soon as you are done with it. In this type of situation, that can create a lot of overhead. Garbage collection will use more memory of course, but will be significantly faster because it optimizes memory deallocation. The infilife algorithm is probably one of the simplest test cases where this pattern can be seen, and where GC runs circles around manual memory management.
"

Problem with GC is that your applications take a performance penalty at unpredictable times - whenever the GC decides to clean-up. That can adversely affect the rest of the application and you have little to no control over it. Yes, some GC algorithms allow you to specify a good time to do GC clean-up, but AFAIK they are neither popular nor the 'top dog' algorithms.

Reply Parent Score: 2

pantheraleo Member since:
2007-03-07

Problem with GC is that your applications take a performance penalty at unpredictable times - whenever the GC decides to clean-up.


Java's default GC behavior (you can tweak it with command line switches) is to try to run GC as an idle task. it will try to wait until no other higher priority threads in the VM are scheduled to run before it does GC. Of course, this isn't always possible if the application is very busy. In those cases, if memory starts to reach the maximum allowed heap space that is configured for the JVM, then the GC might have to run at a less opportune time.

But ideally, it will try to do it as an idle task. Unless it is forced to do otherwise because it is getting close to hitting max heap size.

Reply Parent Score: 2