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
Optimizing Float Ref's
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-08-31 (16:06)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Optimizing Float Ref's
On Friday 28 August 2009 21:32:55 Will M Farr wrote:
> Hello all,
> I'm running OCaml 3.11.1, and I noticed something strange in some
> native code for matrix multiply today.

I'm running OCaml 3.11.0 and I get the opposite result on both x86 and x64:

$ ./will
Took 31.445965s
Took 39.942496s

$ ./will
Took 25.457591s
Took 40.414526s

> But, I thought that float ref's were automatically unboxed by the
> compiler when they didn't escape the local context.  Is this a
> complier bug, is there a bad interaction with unsafe_get and
> unsafe_set, or is there something else going on that I don't
> understand?  Any enlightenment would be appreciated.

That appears to occur in this case on my machine but it can be hampered 
sometimes if the accumulator is returned immediately and the problem worked 
around by performing a redundant floating point operation (such as 1.0 *. x) 
on the result.

Dr Jon Harrop, Flying Frog Consultancy Ltd.