[fpc-devel] Modernising Pascal

Jamie McCracken jamie-junk at blueyonder.co.uk
Fri Feb 25 14:42:05 CET 2005


Sebastian Kaliszewski wrote:
> On Thursday 24 February 2005 14:57, Jamie McCracken wrote:
> 
>>>It's *much* faster than reference counting everything. Reference
>>>counting is more or less the slowest garbage collection technique there
>>>is (except if only very few objects have to garbage collected). It also
>>>can't deal with circular references.
>>
>>Thats why I would want ref count for Tobjects and not Tcomponents.
>>Partial ref counting should be faster than doing GC on everything.
> 
> 
> You could do partial GC as well. No one forces yo to do GC on everything.

You can but that would suck! Mixing unmanaged with managed code needs a 
lot of effort and the performance would be detrimental (marshalling of 
unmanaged objects/types).

> 
> 
> 
>>>>GC gets a lot slower with the more objects you create.
>>>
>>>Reference counting too.
>>
>>GC is worse here because the pointers are not static in GC.
> 
> 
> Not true. There are GC's with static as well as unstatic pointers 
> (compacting GC's move pointers, but there are not compating GC's as well). 
> For example Bohm GC (for C) does not move pointers. And it's GC.

I was referring to compacting GCs - non compacting ones are impractical 
to use unless you have tons of free memory and all the modern ones 
including .Net's generational one is incremently compacting.


> 
> 
> 
>>so
>>referencing an object means looking up the actual address in a lookup
>>list
> 
> 
> Nonsense. It's clear you don't know how typical GC works.

It does in compacting GCs (how else can you get the address of an object?)

> 
> 
> 
>>(so more overhead whenever you call a method or pass an object
>>reference).
> 
> 
> Nope. 

Yes for compacting GCs

> 
> 
> 
>>GC does not use the stack efficiently
> 
> 
> Complete nonsense. GC has nothing to statck. Zero, null, nada...

Exactly it has to use a managed heap which is slower! Unmanaged code can 
use the stack for greater speed. There is a lot of talk about GCs being 
almost as efficient as unmanaged code but I have never seen an 
implementation that comes close to that. C# and Java both have poor 
performance in large apps where you have lots of objects (delphi 2005 is 
also written in .net and it is very sluggish too).

> 
> 
> 
>>and has to use a lot
>>of heap so its extremely inefficient.
> 
> 
> More of the same... It's simply not true. 
> Besides compacting GC supported directly by the langauge allows for 
> extremely effective use of heap -- as effective as that of stack.

But heap is slower than stack.


> 
> 
> 
>>Ever see GC compact swap?
> 
> 
> Better go learn more:
> http://www.iecc.com/gclist/GC-faq.html



> 
> 
> 
>>yes but with GC everything would have to be managed 
> 
> 
> Nope. See above.

In practice yes as above unless you can live with all the extra 
inefficiency.


jamie.





More information about the fpc-devel mailing list