Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror

Comment C++ is ALWAYS faster than Java... NOT! (Score 1) 132

Is's frustratring to see that many C++ programmers
seems not to have any idea about how modern
garbage collectors work.


C++ is not designed to use Garbage collection,
because the collector has no reliable way to find
out if something is a pointer or not. Therefore
only conservative, non-copying collectors can be
used with C++ unless one accepts very stringent
restrictions.


With modern GC's that have a copy phase the time for a GC cycle only depends on the on the number
of remaining objects. The garbage is just left behind. This clearly shows that the GC can be
faster than a simple straightforward C++ solution,
that depends on the number of objects allocated, which is usally much bigger.

Also keep in mind that the GC may run in an idle
phase of the application and therefore the response time that the user sees could be better than if the memory would be deallocated immediately.

Slashdot Top Deals

A morsel of genuine history is a thing so rare as to be always valuable. -- Thomas Jefferson

Working...