Re: OT:C/C++ Opinion Poll
- From: "Wilco Dijkstra" <Wilco_dot_Dijkstra@xxxxxxxxxxxx>
- Date: Fri, 30 Nov 2007 21:57:16 GMT
"Jyrki Saarinen" <jyrki@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:fipeq6$e34$1@xxxxxxxxxxxxxxxxxxxxx
Vladimir Vassilevsky <antispam_bogus@xxxxxxxxxxx> wrote:
C++ doesn't have garbage collection, unless you use a 3rd party library.
A language with pointers can't have garbage collection. C++ without
pointers and with garbage collection is called Java.
That is simply not true.
GC in general with C or C++:
http://developers.sun.com/solaris/articles/libgc.html
The GC gurus page:
http://www.hpl.hp.com/personal/Hans_Boehm/gc/
"Performance of the nonincremental collector is typically competitive with
malloc/free implementations. Both space and time overhead are likely to be
only slightly higher for programs written for malloc/free (see Detlefs,
Dosser and Zorn's Memory Allocation Costs in Large C and C++ Programs.) For
programs allocating primarily very small objects, the collector may be
faster; for programs allocating primarily large objects it will be slower.
If the collector is used in a multithreaded environment and configured for
thread-local allocation, it may in some cases significantly outperform
malloc/free allocation in time."
(for the people think that GC implies a problem in performance; there are
even JVM implementations for hard real-time systems, where there is a
guaranteed upper bound for GC CPU usage, though these seem to be
implementations done in the research, at least last time when I looked)
This paints a rather optimistic picture. In reality pointer chasing many
megabytes of memory is what costs you - no matter what GC you choose,
GC performance is directly proportional to the amount of allocated memory.
The only case where garbage collection can be competitive is when you
give it enough memory so that the collector never needs to run...
For a real-world example of the overhead of GC look at GCC. It got twice
as slow when they moved from region based allocation to GC. Furthermore,
despite all the claims, most collectors don't reduce fragmentation at all or
improve locality. Only compacting collectors do, but they are even slower.
Wilco
.
- References:
- OT:C/C++ Opinion Poll
- From: Ed
- Re: OT:C/C++ Opinion Poll
- From: Tim Wescott
- Re: OT:C/C++ Opinion Poll
- From: Jim Relsh
- Re: OT:C/C++ Opinion Poll
- From: FD
- Re: OT:C/C++ Opinion Poll
- From: The Real Andy
- Re: OT:C/C++ Opinion Poll
- From: FD
- Re: OT:C/C++ Opinion Poll
- From: Jyrki Saarinen
- Re: OT:C/C++ Opinion Poll
- From: Vladimir Vassilevsky
- Re: OT:C/C++ Opinion Poll
- From: Jyrki Saarinen
- OT:C/C++ Opinion Poll
- Prev by Date: Re: Speech output from a microcontroller
- Previous by thread: Re: OT:C/C++ Opinion Poll
- Next by thread: Re: OT:C/C++ Opinion Poll
- Index(es):
Relevant Pages
|