[gclist] Finalizers & Reference counting.

Greg Hudson ghudson@MIT.EDU
29 Aug 2002 11:05:10 -0400

On Wed, 2002-08-28 at 16:47, Reedy,Christopher L. (Chris) wrote:
> I'm sure you've seen the e-mail from Linus Torvalds on the GCC mailing
> list about reference counting versus garbage collection. For those who
> may not have seen it, here is a quote from the e-mail:

> >  I strongly suspect that what makes gcc slow is that it has absolutely
> >  horrible cache behaviour, a big VM footprint, and chases pointers in
> >  that badly cached area all of the time.

Linus probably knows more about gcc than I do, but I think spending lots
of time in the kernel may have skewed his judgment.  Visible performance
problems in the real world almost always stem from algorithms with poor
scaling characteristics (O(n^2) or worse, where n is actually growing
large).  Not cache locality, not "hot spots" which need to be
hand-optimized, not anything like that.

Kernel programmers live in a world where cycle-counting optimizations
may make sense: every program on the system uses the kernel, so every
clock cycle you save in a common system call shaves off a little bit of
time for every program anyone runs.  libc programmers live in the same
world.  Everyone else should be looking at their algorithms and ignoring
the rest.