[comp.lang.c++] performance of GC

daniel@terra.ucsc.edu (Daniel Edelson) (01/20/91)

	From: chased@rbbb.Eng.Sun.COM (David Chase)
	Newsgroups: comp.lang.c++
	Subject: Re: Smart Pointers -- A proposed language extension
	Date: 19 Jan 91 00:33:31 GMT
	References: <lots>
	Organization: Sun Microsystems, Mt. View, Ca.

	....
	Edelson presents evidence that a fairly naive compacting C++ collector
	can run about as quickly as manual allocation....

Some of those measurements need to be reconducted and should be taken
with a grain of salt. They are almost certainly relatively correct,
though.  They did demonstrate (and the conclusion 
is reliable) that for some data structures copying 
collection is substantially more efficient than other forms of 
reclamation.

In particular, consider recursive destruction of a Tree data structure
by the destructors, i.e., the deletion of the root of a tree causes the
recursive deletion of the rest of the tree from the internal nodes to
the leaves. This involves many menory references. The alternative, 
elimination of the tree in one constant time operation by 
the collector is vastly more efficient. 

Daniel Edelson
daniel@cis.ucsc.edu

mjv@objects.mv.com (Michael J. Vilot) (01/28/91)

Daniel Edelson remarked on the relative performance of automated vs. manual
storage reclamation.  He specifically mentioned destruction of a Tree data
structure.

Those interested in seeing a specfici example might want to examine Section 7.4
of Steve Dewhurst & Kathy Stark's ``Programming in C++.'' It provides an example
of overloading operators new and delete for tuning management of parse tree 
nodes.

--
Mike Vilot,  ObjectWare Inc, Nashua NH
mjv@objects.mv.com  (UUCP:  ...!decvax!zinn!objects!mjv)