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

Re: Strong Typing, Dynamic Languages, What to do?



Hi,

> Sebastian H Seidel wrote:
> 
> >Other factors concerning speed might be:
> > - Explicit memory-management beats garbage-collection.
> 
> Evidence?
> 
> Shriram

I love the freedom that I gain because of garbage-collection and only
reluctantly I go back to program C.
For the following reasons I think this freedom is bought by a little
performance-loss:

- Allocated memory in C is guaranteed to stay in place ... so you can
have very efficient sorting-routines, for example.

- Whatever algorithm the GC uses to distinguish live from free-able
memory-objects, it has to 'look' at every object. The more objects it
manages the longer this will take -> GC-Time is proportional to number
of GC-managed heap-objects.

- So its better to allocate memory in big parts (like the usual
efficiency-concerned C-programmer propably does) and not
little-by-little (like the GC eventually might be tempted to do).

- The more little memory-objects are chopped out of the heap
(non-contigiously), the longer it will take a 'malloc' to find a
sufficiently large piece of memory if it is needed.

This is not evidence.

Also, I do not care because Scheme should be the Intelligentsia and
performs fine when bossing little C-Primitives around.
I could imagine that in large programs a robust GC may also lead to
faster execution because it fights leakage.

Sebastian