[Shootout-list] Re: Stuff

Jon Harrop jon@ffconsultancy.com
Sun, 24 Apr 2005 11:34:49 +0100


On Sunday 24 April 2005 10:31, Aaron Denney wrote:
> On 2005-04-24, Pascal Obry <pascal@obry.net> wrote:
> > I certainly do not agree. A garbage collector is certainly slower
> > than a simple hand-written reference counter.
>
> Well, a naive one may be.  Sophisticated ones are not.  Reference
> counters need to be updated at essentially every access.

More importantly, reference counters tend to access memory randomly which 
costs a great deal on modern hardware. In contrast, garbage collectors can be 
optimised to try to access memory more sequentially and more localised.

I think it is now generally accepted that a good GC is faster than reference 
counting and, more importantly, can be guaranteed to work.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists