Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Gripes with array
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe Raffalli <Christophe.Raffalli@u...>
Subject: Array.init (was [Caml-list] Gripes with array)

> 
>>>Also, can Array.init be made to fill the elements only once?
>>
>>No, that's impossible without breaking the GC invariants.
> 

This is not true if the runtime maintains a list of array in 
construction with the current position of the index. This list will stay
rather small, but each addresse read by the GC will have to be checked 
for membership in the list. If the list is rather small it will be in 
the cache, but still I am afraid it will slow down noticably the GC.

Did someone tried to implement such a list of partially initialized 
objects in the GC ?

You could also lie in the tag about the size of array (if the way the 
runtime finds free block of memory does not use it). It will cost an 
increment of integer at each step in the initialisation process which 
should not be much since the beginning of array may stay in the cache if 
the initialisation function is simple and this will be neggligeable if not.


-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature
---------------------------------------------