English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Re: About array
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-10-15 (13:59)
From: Anton Moscal <msk@p...>
Subject: Re: About array
On Tue, 12 Oct 1999, Damien Doligez wrote:

> >From: Anton Moscal <msk@post.tepkom.ru>
> >Evaluation `f i' can cause GC call -> we must use modify function. Really
> >we can check address of our fresh array after each `f i'. While this
> >address remains unchanged we have no need to call `modify'. I think this
> >will be good.
> Wrong.  There is no guarantee that the GC will move your fresh array.
> In most cases it will not because the array will already be in the
> major heap.

Oops, this is an error. But correct test can be easily written in C
(simply test address range)

> >I made the following experiment:
> [replacing Array.init with a home-brewed version]
> >time became 0.97 sec (but this version will not work
> >with float arrays)
> Indeed, it only works with int arrays.  And the only reason it's

I think it will be works in the current implementation with array of any
types except float (if we replace algorithm for testing for array location
in young heap on correct version). Why not? (of course this is not correct
code from point of view of the language definition)