<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2002/07/53a818fc3a885dc850b4e8564b4c81f4"
  from="Travis Bemann &lt;bemann@e...&gt;"
  author="Travis Bemann"
  date="2002-07-30T05:46:54"
  subject="Re: [Caml-list] Caml productivity."
  prev="2002/07/0efd71474f4d41a39e4250aeddcf08e5"
  next="2002/07/fee6c3e5331f7ec8db2fdd96df87865d"
  prev-in-thread="2002/07/12e4dec5bbe67f35890781b7b85d03ce"
  next-in-thread="2002/07/b94153a499cfb8e624d1b8a1e738c808"
  prev-thread="2002/07/71c26b67baafe720885c555fc4a75f00"
  next-thread="2002/07/ed6e258ddd3082e1de940b5ff3b369ea"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Caml productivity.">
<msg 
  url="2002/07/1ba7258845ed8bd9491c0456e7a05b1e"
  from="Pal-Kristian Engstad &lt;mrengstad@y...&gt;"
  author="Pal-Kristian Engstad"
  date="2002-07-20T13:48:44"
  subject="[Caml-list] Caml productivity.">
<msg 
  url="2002/07/509362a68506d7ed09d0be89b9c9e4f6"
  from="William Chesters &lt;williamc@p...&gt;"
  author="William Chesters"
  date="2002-07-20T15:14:05"
  subject="[Caml-list] Caml productivity.">
<msg 
  url="2002/07/141365db2b93dfaff20df60620a672c4"
  from="Pal-Kristian Engstad &lt;engstad@n...&gt;"
  author="Pal-Kristian Engstad"
  date="2002-07-22T18:08:37"
  subject="RE: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/70d8fb7b01ce74769871069813828d50"
  from="achrist@e..."
  author="achrist@e..."
  date="2002-07-22T18:40:54"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/1929e85adb2dce6bd413f9c176c9d282"
  from="Pal-Kristian Engstad &lt;engstad@n...&gt;"
  author="Pal-Kristian Engstad"
  date="2002-07-22T19:08:59"
  subject="RE: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/a479967b0001a3186b117aad08de5bf4"
  from="Michael Tucker &lt;mtucker@e...&gt;"
  author="Michael Tucker"
  date="2002-07-22T21:13:43"
  subject="[Caml-list] CamlIDL and function pointers">
<msg 
  url="2002/07/78b04a2826c047ba4cdd21788624fcae"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-23T08:39:19"
  subject="Re: [Caml-list] CamlIDL and function pointers">
<msg 
  url="2002/07/a7e0cdd9dfa5e79f251fa9a3482ba382"
  from="Dmitry Bely &lt;dbely@m...&gt;"
  author="Dmitry Bely"
  date="2002-07-23T13:15:38"
  subject="Re: [Caml-list] CamlIDL and function pointers">
</msg>
<msg 
  url="2002/07/c7b19622fa8d83e32adb0e632a0eb2ae"
  from="Michael Tucker &lt;mtucker@e...&gt;"
  author="Michael Tucker"
  date="2002-07-24T15:00:58"
  subject="Re: [Caml-list] CamlIDL and function pointers">
<msg 
  url="2002/07/c80262d8a5079c5a0ef409a674edce6f"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-25T09:36:15"
  subject="Re: [Caml-list] CamlIDL and function pointers">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/e3ce9c7cf91bf6db61d44124f79a98f5"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-22T21:24:19"
  subject="Games (Re: [Caml-list] Caml productivity.)">
<msg 
  url="2002/07/8a5ec6fb7a11d61c196ce24b8ffb906d"
  from="Issac Trotts &lt;issac@m...&gt;"
  author="Issac Trotts"
  date="2002-07-23T02:57:07"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
<msg 
  url="2002/07/e42b072cfbe92ebadd7aa6957e1eab4f"
  from="eijiro_sumii@a..."
  author="eijiro_sumii@a..."
  date="2002-07-23T11:03:32"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
<msg 
  url="2002/07/7c0a72b352be55944287390245b75756"
  from="Charles Martin &lt;caml.list@g...&gt;"
  author="Charles Martin"
  date="2002-07-23T16:17:12"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
</msg>
<msg 
  url="2002/07/9922f6f9613f2b6e0ba1c17ad7d199fd"
  from="Andrei de A. Formiga &lt;andreif@i...&gt;"
  author="Andrei de A. Formiga"
  date="2002-07-29T03:33:30"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
<msg 
  url="2002/07/7d49d2bb4f0f8d0da011582d590f1f5d"
  from="Florian Hars &lt;florian@h...&gt;"
  author="Florian Hars"
  date="2002-07-29T06:33:15"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
</msg>
<msg 
  url="2002/07/ffef81171738879a74f9340fe64c5163"
  from="eijiro_sumii@a..."
  author="eijiro_sumii@a..."
  date="2002-07-29T10:23:23"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
<msg 
  url="2002/07/e5ad30ad3d085e195c5e4d8b7ad94acd"
  from="eijiro_sumii@a..."
  author="eijiro_sumii@a..."
  date="2002-07-30T16:50:19"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
<msg 
  url="2002/07/25f7863b64a6f6263bbd7d137a563d91"
  from="Jonathan Coupe &lt;jonathan@m...&gt;"
  author="Jonathan Coupe"
  date="2002-07-30T18:08:36"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
<msg 
  url="2002/08/43f12f51de81c774b505f143cf807619"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-08-01T15:39:57"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
<msg 
  url="2002/08/0052e34d5ed2c650be1c71bf603dfd84"
  from="Markus Mottl &lt;markus@o...&gt;"
  author="Markus Mottl"
  date="2002-08-01T16:00:17"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
</msg>
<msg 
  url="2002/08/fb054c8450791b2ff36f144d26f6ad13"
  from="Jonathan Coupe &lt;jonathan@m...&gt;"
  author="Jonathan Coupe"
  date="2002-08-02T09:02:46"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
<msg 
  url="2002/08/d0fd4f4b272f5851effd2c41d20936c3"
  from="Jonathan Coupe &lt;jonathan@m...&gt;"
  author="Jonathan Coupe"
  date="2002-08-02T12:44:46"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
</msg>
<msg 
  url="2002/08/93c02d1b6710aa1b7b69bd8f3f88181b"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-08-02T14:51:20"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
</msg>
</msg>
</msg>
<msg 
  url="2002/07/212b6a76b1fb65f098665099a02647f7"
  from="eijiro_sumii@a..."
  author="eijiro_sumii@a..."
  date="2002-07-31T01:11:47"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/d13acda5053494df37964bb408085bad"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-25T03:23:14"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
<msg 
  url="2002/07/fd3e6d80be919abc06bcfd0ee2ffadda"
  from="Jonathan Coupe &lt;jonathan@m...&gt;"
  author="Jonathan Coupe"
  date="2002-07-28T13:40:44"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
<msg 
  url="2002/07/0c819bf6e19d28995f6ef2036db39e5f"
  from="Michael Vanier &lt;mvanier@c...&gt;"
  author="Michael Vanier"
  date="2002-07-29T15:49:35"
  subject="Re: Games (Re: [Caml-list] Caml productivity.)">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/7e19da946c160f365e8f4fe6773374dd"
  from="Alexander V.Voinov &lt;avv@q...&gt;"
  author="Alexander V.Voinov"
  date="2002-07-22T22:06:37"
  subject="Re: [Caml-list] Caml productivity.">
</msg>
</msg>
</msg>
<msg 
  url="2002/07/e6c3d1cb6aed17c094cbe8798d5b73e9"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-20T15:24:38"
  subject="Re: [Caml-list] Caml productivity.">
</msg>
<msg 
  url="2002/07/7a65a2a07ceccfa4e53d0f1c228dbd4f"
  from="Tom &lt;tom7ca@y...&gt;"
  author="Tom"
  date="2002-07-22T06:42:01"
  subject="Re: [Caml-list] Caml productivity.">
</msg>
<msg 
  url="2002/07/9ce195764ef654a5dfb7205f3c85a290"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2002-07-22T10:47:05"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/c1d27612820e9d845f7a8b7c0a41d2aa"
  from="Pal-Kristian Engstad &lt;mrengstad@y...&gt;"
  author="Pal-Kristian Engstad"
  date="2002-07-23T20:56:10"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/0c313e90b642f8f12bb25f25ea9fbcfd"
  from="Travis Bemann &lt;bemann@e...&gt;"
  author="Travis Bemann"
  date="2002-07-24T04:20:33"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/5d55e595caac57c62e5dc2e86b63de1e"
  from="Pal-Kristian Engstad &lt;mrengstad@y...&gt;"
  author="Pal-Kristian Engstad"
  date="2002-07-26T21:07:18"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/b212f6e35c549581b16b6624a1a56abb"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-26T21:46:45"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/d7dbdd3a140874d79a422a0b80cbdf63"
  from="Issac Trotts &lt;issac@m...&gt;"
  author="Issac Trotts"
  date="2002-07-27T04:42:05"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/522d76f4ddafad8c4f1e0778ad37a4f1"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-27T05:53:17"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/c2850575bbf44763e83d5c50f6d5159b"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-27T14:49:36"
  subject="Re: [Caml-list] Caml productivity.">
</msg>
</msg>
</msg>
<msg 
  url="2002/07/251d81ff74aa60825afd904604b8c5d3"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-27T09:06:23"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/1965eaa1e57e08ccf423e4415d99cd48"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-28T00:10:49"
  subject="Re: [Caml-list] Caml productivity.">
</msg>
</msg>
</msg>
<msg 
  url="2002/07/12e4dec5bbe67f35890781b7b85d03ce"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2002-07-29T08:13:59"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/53a818fc3a885dc850b4e8564b4c81f4"
  from="Travis Bemann &lt;bemann@e...&gt;"
  author="Travis Bemann"
  date="2002-07-30T05:46:54"
  subject="Re: [Caml-list] Caml productivity.">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/b94153a499cfb8e624d1b8a1e738c808"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2002-07-24T08:02:55"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/d8be09893e051cef83916581376ca7b6"
  from="Jérôme_Marant &lt;marant.logatique@f...&gt;"
  author="Jérôme_Marant"
  date="2002-07-24T08:28:04"
  subject="Re: [Caml-list] Caml productivity.">
</msg>
<msg 
  url="2002/07/0d311d854b7f7713630895700b3b416b"
  from="Pal-Kristian Engstad &lt;mrengstad@y...&gt;"
  author="Pal-Kristian Engstad"
  date="2002-07-26T21:06:52"
  subject="Re: [Caml-list] Caml productivity.">
<msg 
  url="2002/07/e80e9e57f434ec7a846466c3cb92003c"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-27T09:06:15"
  subject="Re: [Caml-list] Caml productivity.">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
On Mon, Jul 29, 2002 at 10:13:24AM +0200, Nicolas Cannasse wrote:
&gt; &gt; I agree that the C interface is pretty nice. However,
&gt; &gt; how do would you use SIMD math instructions on the
&gt; &gt; x86? Would you always call C-routines just to make use
&gt; &gt; of SIMD or multimedia-instructions? What is the
&gt; &gt; overhead for calling a function that is executing a
&gt; &gt; few assembly instructions? Is it even possible to
&gt; &gt; create a solid division line between "low-level" and
&gt; &gt; "high-level" code?
&gt;
&gt; Yes it is.
&gt; Actually if you need to perform alot of SIMD instructions each frame
&gt; (involving zounds of C calls), you can try to group them in one-C-call that
&gt; will do the job in one time. That's matter of architecture and choices...
&gt; not always obvious :)

Note that most C or C++ compilers won't do this either, with the
exception of some specialized vector parallelizing compilers (such as
those used to compile code on vector supercomputers).  If you really
need SIMD instructions, you'd probably need to hand-code it in
assembly, no matter what language you're using.

&gt; &gt; There's something to be said for premature
&gt; &gt; optimizations, but don't you think there's something
&gt; &gt; to be gained from having inline assembly in O'Caml? In
&gt; &gt; C++, one can create inline SIMD floating point vector
&gt; &gt; operations. A.I. and behaviour code constantly use 3D
&gt; &gt; math that would benefit from inline assembly.
&gt;
&gt; I don't think OCaml is the best language for that kind of things...
&gt; If I remember my Pascal days, the compiler was so bad that i was used to
&gt; write asm code directly in Pascal functions to perform all the 2DFx job :)
&gt; And even if I enjoyed it because of the great perfs, it's not a good way of
&gt; programming.
&gt;
&gt; If you're using OCaml as a top-level scripting langage, you have to put some
&gt; barriers on what you can or can't do. Doing alot of "low-level" instructions
&gt; needing SIMD optimizations is not the job of a scripting langage. So if you
&gt; really need to do them, just move them into a C proc. OCaml code is actually
&gt; only doing the following in my implementation :
&gt; - moving the Camera
&gt; - handling events ( network messages and user mouse/keyb ones )
&gt; - setting meshes current position and animation
&gt; - same for sprites

Well, according to some rather large sets of benches, code natively
compiled with OCaml 3.04 is often faster than C++ code compiled with
gcc 3.0 (on x86), and a number of 3D games are written in C++, such as
bzflag. And from my experience, bzflag has no speed problems
whatsoever, with 20 AI players all running on the same machine, and
I'm using gcc 2.9-sometyhing, which has far *worse* C++ compilation
(both support and performance-wise) than gcc 3.0.

Therefore, I would think that it would be safe to conclude that
anything in userspace that you can really use C++ for you can use
OCaml for (with the one exception of directly manipulating shared
memory).  And if C++ isn't fast enough, then either your machine is
too slow for the load OR the problem isn't the language, per se, but
rather your algorithms and implementation.  If you aren't doing
embedded programming (or doing something such as original PlayStation
programming), yet feel yourself needing to use hand-optimized C or
assembly for most of your code, you're probably doing something wrong,
whether it's trying to do too much in realtime or it's doing a very
algorithmically inefficient implemntation.  Try to use faster/more
scalable algorithms before you really decided that hand-coded C or
assembly is the only way.  And even still, only use hand-coded C or
assembly at points where it is critical.

(Note: I had earlier accidentally CCed this back to myself, rather
than to caml-list)

-- 
Yes, I know my enemies.
They're the teachers who tell me to fight me.
Compromise, conformity, assimilation, submission, ignorance,
hypocrisy, brutality, the elite.
All of which are American dreams.

              - Rage Against The Machine
</contents>

</message>

