caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: [Caml-list] Caml productivity.
@ 2002-07-23  2:08 Arturo Borquez
  0 siblings, 0 replies; 25+ messages in thread
From: Arturo Borquez @ 2002-07-23  2:08 UTC (permalink / raw)
  To: "Pal-Kristian Engstad"; +Cc: caml-list

"Pal-Kristian Engstad" <engstad@naughtydog.com> wrote:

>I am also quite surprised by ocaml's speed. It's doing quite well on a lot
>of platforms. And I would concur that it does quite well when compared to C
>and Fortran. However, that is not quite enough. For me, it isn't enough that
>the compiler is doing a decent job. I want to have the capability to make
>the code even better. To do that, one needs to be able to make use of the
>hardware, i.e. get down to the bare bones of your platform. Yes, it will
>mean that you are giving up portability. Yes, it might be "unsafe", but then
>again, why are there unsafe set and get operations for arrays in ocaml?
> ....

OCaml not too bad?
If you want more I suggest to compile with ocamlopt with the switch -S
(keep intermediate assembly source output) and take a look. Maybe you'll
find the way to strip out some cpu cycles, or maybe you have a better
'faster' GC system. 

>Imagine that there is a special LZWC instruction that counts the number of
>leading zeroes in a 64-bit word. I would love to be able to write >something
>like:
>
>let lzc (x:int64) = inline
>regs res : int32 of  (** Work registers **)
>lzwc res, x (** Opcodes sent to the assembler **)
>return res              (** result of the computation **)

>let main =
>   Printf.printf "lzc %d = %d\n" 12 (lzc 12)
>

You can do such thing in OCaml calling a 'C' function, I don't see
where is the problem, even more inside 'C' functions you can code
inline assembler. So you can build your own critical time massive
cpu crunching code that way and use OCaml on the top (where C is bad)

-- 
Arturo Borquez



__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.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


^ permalink raw reply	[flat|nested] 25+ messages in thread
* [Caml-list] Caml productivity.
@ 2002-07-15 21:22 Pal-Kristian Engstad
  2002-07-20 15:16 ` William Chesters
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: Pal-Kristian Engstad @ 2002-07-15 21:22 UTC (permalink / raw)
  To: caml-list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 2579 bytes --]

Some proponents of this mailing list seem to be
convinced that Ocaml is so much more productive than
C++. I find this to be a terrible mistake. From an
industry where performance is crucial (games
programming), I find quite a few aspects of Ocaml hard
to unify with productivity.

There is something to be said for syntax. Syntax
should help the programmer, not the compiler. In
games, it is standard to have a huge library of
classes dealing with mathematical concepts. A minimum
requirement is support for matrices, vectors,
quaternions and splines. This usually also entails
inline assembly, taking advantage of SIMD instruction
sets. Operator overloading is very important to games
programmers, especially for AI and behavior code.

Here is a short list of items that I’ve found
illogical and inconvenient for C/C++ programmers in my
field:

1. The lack of operator overloading, especially
floating-point operations.
2. The lack of bit-fiddling operations.
3. The lack of inline assembly constructs.
4. The non-obvious layout of variables (essential for
optimized functions).
5. The non-obvious differences between arrays and
“inline” arrays.
6. The non-obvious behavior of garbage collection.

One has to understand that when performance is
super-important, one cannot just rely on the compiler
anymore. Some sections of the code have to be
optimized by hand, and it is here that Ocaml falls
short of C/C++. 

As an example, imagine that you want to define:

struct Elems {
	u32 handle;
	u16 numData;
	u16 index;
};

struct Data {
	Elems elem[128];
	u8 buffer[16 * 1024];
};

Data *data = (Data *)0xabadbeef;

This is a very clear layout. One wants the data in a
very specific memory configuration. One needs to know
the exact sizes of the data structure. This could for
instance map to special hardware that is laid out in
this way. This is impossible to do with Ocaml.

Now, Ocaml is a great language for some tasks. I’ve
successfully used it with Facile, a constraints
solver. The parsing of the input was a breeze compared
to a similar C/C++ solution. But one can’t go around
claiming that Ocaml is a productivity enhancer for all
tasks. Games programming certainly isn’t one of them.

PKE.



__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.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


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2002-07-30  5:46 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-23  2:08 [Caml-list] Caml productivity Arturo Borquez
  -- strict thread matches above, loose matches on Subject: below --
2002-07-15 21:22 Pal-Kristian Engstad
2002-07-20 15:16 ` William Chesters
2002-07-22 18:22   ` Pal-Kristian Engstad
2002-07-22 18:41     ` achrist
2002-07-22 19:23       ` Pal-Kristian Engstad
2002-07-22 22:00     ` Alexander V.Voinov
2002-07-20 15:25 ` Oleg
2002-07-22  6:41 ` Tom
2002-07-22 10:46 ` Nicolas Cannasse
2002-07-22 17:46   ` Pal-Kristian Engstad
2002-07-24  3:20     ` Travis Bemann
2002-07-24  9:45       ` Pal-Kristian Engstad
2002-07-26 21:42         ` Chris Hecker
2002-07-27  4:41           ` Issac Trotts
2002-07-27  5:49             ` Chris Hecker
2002-07-27 14:49               ` John Max Skaller
2002-07-27  9:06           ` Oleg
2002-07-27 18:18             ` Chris Hecker
2002-07-29  8:13         ` Nicolas Cannasse
2002-07-30  4:46           ` Travis Bemann
2002-07-24  8:02     ` Nicolas Cannasse
2002-07-24  8:25       ` Jérôme Marant
2002-07-24 10:00       ` Pal-Kristian Engstad
2002-07-27  9:06         ` Oleg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).