Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] 32 bit floats, SSE instructions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] 32 bit floats, SSE instructions
> Basically it's not an answer to say "Ah, yes, look at this great
> language OCaml!" when in practice all you're ever doing is writing C.
>
> I'm not exactly sure why language designers think 32 bit floats "don't
> count."  Quite a number of high level languages make the choice of
> blowing them off.  I guess quite a lot of high level languages aren't
> interested in widespread industrial application, just ease of compiler
> implementation.  The reality is that 32 bit floats get used in the real
> world all over the place by 3D graphics guys.  That has something to do
> with it being a core capability of many CPUs and an IEEE standard.  64
> bit floats cost twice as much memory, are much slower for division and
> square rooting, and in many applications the extra precision is not
> needed.

The main problem with float's - whatever if they are 32 or 64 bits - is
their boxing . OCaml runtime value representation is efficient but a float -
even 32 bits - cannot be carried in a register as it could be in C.
(actually some unboxing can be performed locally by ocamlopt). This is
mainly because OCaml is an high-level language, with a garbage collector,
and so needs to keep the track of what is being allocated in an efficient
way. Did you imagine having an higher level programming language for free ?
So yes maybe OCaml is not the best language to perform floating point
operations, although the cost of boxing is actually quite small compared to
the power of implementing easily more efficient algorithms. That's why you
should perform batched operations in C - using 32bits float if you want -
and manipulate your 64-bits vectors on the Ocaml side.

> The last time I tried to talk about 32 bit floats with 'language guys'
> was the Python crowd.  Generally speaking, that community doesn't have a
> clue about performance, and hasn't coughed up any significant 3D
> graphics work either.

I guess that people who're refcounting don't care about performances :)

Nicolas Cannasse


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners