[squeak-dev] Re: How weak finalization affects the performance

Levente Uzonyi leves at elte.hu
Thu Nov 4 20:42:49 UTC 2010


On Thu, 4 Nov 2010, Chris Muller wrote:

>>> Here, at each GC cycle, a 'dict finalizeValues' will be sent,
>>> which leads to looping over 1000 entries.
>>> Add dict with 10000 entries, and you will loop over 10000 after each GC.
>>
>> You should never register WeakKeyDictionaries to the finalization process.
>> They are not thread safe.
>>
>> Since the next VMs will support your new finalization scheme, I see no
>> benefit from the delay.
>
> Igor, I know I'm very late to this discussion but..  The other benefit
> to the Delay that your finalization scheme does not solve is the fact
> that there could be a lot of _registrants_ in WeakArray that need to
> be enumerated after every GC.
>
> Correct me if I'm wrong, but your finalization fix only allows each
> individual registrant to "clean quickly" rather than do a full
> enumeration; is that right?
>
> If there are 5000 registrants in WeakArray, the delay would prevent
> enumerating 5000 elements after every GC unless 5 seconds have
> elapsed.  So we are we not best off with _both_ your finalization fix
> _and_ the delay...?

5000 WeakRegistries sounds unrealistic. Btw, the delay would cause 
failure in most Weak* tests. It would also make constructs like 
#retryWithGC:until:forFileNamed: or #repeatWithGCIf: pointless.


Levente

>
> - Chris
>
>



More information about the Squeak-dev mailing list