Browse thread
Optimizing Float Ref's
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Dmitry Bely <dmitry.bely@g...> |
| Subject: | Re: [Caml-list] Optimizing Float Ref's |
On Thu, Sep 3, 2009 at 1:44 PM, Xavier Leroy <Xavier.Leroy@inria.fr> wrote:
(...)
>> But, I thought that float ref's were automatically unboxed by the compiler
>> when they didn't escape the local context.
>
> Yes, if all uses of the float ref are unboxed, which is the case in
> your code.
let max_val (a:float array) =
let m = ref min_float in
for i = 0 to (Array.length a) - 1 do
if a.(i) > !m
then m := a.(i)
done;
!m
!m is not unboxed (Ocaml 3.11). Should it?
- Dmitry Bely