Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Caml productivity.
[ 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] Caml productivity.
> I agree that the C interface is pretty nice. However,
> how do would you use SIMD math instructions on the
> x86? Would you always call C-routines just to make use
> of SIMD or multimedia-instructions? What is the
> overhead for calling a function that is executing a
> few assembly instructions? Is it even possible to
> create a solid division line between "low-level" and
> "high-level" code?

Yes it is.
Actually if you need to perform alot of SIMD instructions each frame
(involving zounds of C calls), you can try to group them in one-C-call that
will do the job in one time. That's matter of architecture and choices...
not always obvious :)

> There's something to be said for premature
> optimizations, but don't you think there's something
> to be gained from having inline assembly in O'Caml? In
> C++, one can create inline SIMD floating point vector
> operations. A.I. and behaviour code constantly use 3D
> math that would benefit from inline assembly.

I don't think OCaml is the best language for that kind of things...
If I remember my Pascal days, the compiler was so bad that i was used to
write asm code directly in Pascal functions to perform all the 2DFx job :)
And even if I enjoyed it because of the great perfs, it's not a good way of
programming.

If you're using OCaml as a top-level scripting langage, you have to put some
barriers on what you can or can't do. Doing alot of "low-level" instructions
needing SIMD optimizations is not the job of a scripting langage. So if you
really need to do them, just move them into a C proc. OCaml code is actually
only doing the following in my implementation :
- moving the Camera
- handling events ( network messages and user mouse/keyb ones )
- setting meshes current position and animation
- same for sprites

Nicolas Cannasse
www.motion-twin.com

-------------------
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