[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strong typing, dynamical languages, what to do?



Oscar Fuentes writes:
> Shriram Krishnamurthi <sk@cs.brown.edu> writes:
>
> > Sebastian H Seidel wrote:
> >
> > > - Explicit memory-management beats garbage-collection.
> >
> > Evidence?
>
> The above statement belongs to the same class than "A good compiler
> generates faster executables than assembler programmers". As every
> experienced assembler programmer knows, it is a blatant lie.
>
> Let's resort to logical demonstrations:

Hmm.

A classic paper:

"Garbage Collection Can Be Faster Than Stack Allocation",  1987
by Andrew W. Appel.

It is available on CiteSeer:

    http://citeseer.nj.nec.com/appel87garbage.html

The abstact says:

   Abstract: A very old and simple algorithm for garbage collection gives
  very good results when the physical memory is much larger than the number
  of reachable cells. In fact, the overhead associated with allocating and
collecting
  cells from the heap can be reduced to less than one instruction per cell
by increasing
  the size of physical memory. Special hardware, intricate
garbage-collection algorithms,
  and fancy compiler analysis become unnecessary

The paper have a very clear analysis; and it is very easy to follow the
argumentation.
This conclusion surprised me the first time I saw it:

  In fact, the overhead associated with allocating and collecting
  cells from the heap can be reduced to less than one instruction per cell
by
  increasing the size of physical memory.

That's hard to beat manually.

--
Jens Axel Søgaard