From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id HAA17644; Tue, 30 Jul 2002 07:46:54 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA17400 for ; Tue, 30 Jul 2002 07:46:53 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from execpc.com (d134.as6.nwbl0.wi.voyager.net [169.207.130.8]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g6U5kn117696 for ; Tue, 30 Jul 2002 07:46:50 +0200 (MET DST) Received: (from travis@localhost) by execpc.com (8.9.3/8.9.3) id AAA00782; Tue, 30 Jul 2002 00:46:38 -0400 Date: Tue, 30 Jul 2002 00:46:38 -0400 From: Travis Bemann To: Nicolas Cannasse Cc: caml-list@inria.fr Subject: Re: [Caml-list] Caml productivity. Message-ID: <20020730004638.C703@execpc.com> References: <20020724094534.37196.qmail@web13303.mail.yahoo.com> <008801c236d7$d285d550$0700a8c0@warp> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="aT9PWwzfKXlsBJM1" Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <008801c236d7$d285d550$0700a8c0@warp>; from warplayer@free.fr on Mon, Jul 29, 2002 at 10:13:24AM +0200 X-Security: Consider encrypting or at least authenticating your email Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk --aT9PWwzfKXlsBJM1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 29, 2002 at 10:13:24AM +0200, Nicolas Cannasse wrote: > > 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 th= at > will do the job in one time. That's matter of architecture and choices... > 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. > > 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 s= ome > barriers on what you can or can't do. Doing alot of "low-level" instructi= ons > needing SIMD optimizations is not the job of a scripting langage. So if y= ou > really need to do them, just move them into a C proc. OCaml code is actua= lly > 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 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) --=20 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 --aT9PWwzfKXlsBJM1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v0.9.9 (GNU/Linux) Comment: For info see http://www.gnupg.org owFtWL+PHEkVtu9EMtIgXUr0ZCR29zwz3lufAC/YZjXLwSD57DtbmAuru6uny9td 1VRV7+w44EcEESBBeAEpGfwFJGRIJCQQEJJBfhl871X17Oz5HNnTXa/e+973fe+1 fzN9+/Zb71x+9O+/tD/8469u//U/8dbDD74yXzobtY3zF9ten1LUV/Fe3ypjv0Vl o3zQ8eEQ5iqUxkwn47vnJvQumGicPSVjW2P19cMXXtlQaz//ri1dZez6lH48uKir ee+Njapo8fJ08tTSE2dn9IOhpZMHMzo5Pj4hFem949P37p+evH/2hO4e48cZfWhK 16pAS2WtCkHTxiPc6XTyiB7RitTaa02xwdnYaFoioah9rUpNJlDvdYxbsqbUC/q+ 2+hL7WfpaOM2VDnauKGtaOsGGhD7+erJOXUqNggToh9KLjKQsxw8nbv65tcf08vd KdVu1DZQqdqWlnPvhgg4Ar0aAhJyiHWhOXI66+p0g/PUDW00na6Mmu9fhdBcClLf XeiQc6NVRTWO8T0AlRTVg5UjqXYc0Fe65NvxMB2s9YYYsa5ot3TzklUgEwloWEIr g0FXkG06VnqtosYNwbWmospcmsD3cJ+p0HGjcepO6zbzFgHaO6RslU7eacy6GX9F 9/Vj/M6PPtFynwkL/tdZGQeUgZxqgdBqXTFWPfrmfAdIXdxBdaMPWpUN1V51As2h sZeuveSKX7vBVoEPLQWicDST0KUCPn7L0dfoTc+odoiJjur5ci5di83D6URFjrgx +DdIwUx65Yr8InGjFvQCOB8EZgcIxlcpXzYmalTjNYMAyTgQLSwWUqZFFZkd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gg/TB7fQcPWBq 8aTSaSygfTjNlA5OFrNUzskxna0IW+iWSc9i9oO1jFVawxKsHVYB2NgsbR+rgy4L jos6WTyYi4dv2ZkQtjFIle+vlad30feg390bubllh4XD9Zh3vfNRsMiOolDGfGOC PkqAZuBkFMkYwkvIZJXddhwmbGnXDoy0a53mrC3boUorAMaf3abxBVyZf6Hn3TXu Cz2Liz2Kk2ZGjY9ktUwE4J8Pxx1BZs6NNWHnnijH9EObxk7Alq8BIPza+S1Pd+4i pM0XmcDuwlSCXbph3YiB27yQcA5+7APexT7h0F6INI8ITRhuFT39WP6eO56DytM8 UWaMMzgvQ3k6yUqQ6KpdO9Cu6ZI+b2r+ehVBDckHZWbz6KmqRLLRn0Fyn83kemHI DIaRmrWxGCfPQLrnMdNh7zRvkxpIaJg35xV0W+9MFC3lzshek70Ud/NWd73bCCKy 7bk6VcaCnI2zYrckfT5DfOuAwCwSLaDIOMJCm+9lmwXmHddhEk94V+XJIG+mcApr hYdr7MA0ZVq/sRTUpjRsYwnZa2BfpKWZC0tWcg/8ANV46vI33H5nCuH/3k5IFZZR boCweLfwvQFKXi/E6DFYM/lkRodo2Cfl0Q7dLwzCs5p3J2zNLMX0nYFVC66MXEWj h7xxn0KfDeiolW8xTtmCkSMq5oSXS8kWBwtVXsiH25abPMu+zLsyf0pAvZDavDUh yio/nz88OZ5OPmGPXtGFBffZ/KzujOaPHbjDlhvMZUb+epHtvkHbMAYwSjhijY8m zEi94I/oDlToDGsBNsHeYyIWYxQLWiWfYuMt8EqQv5u1dZ79CSRptr1D3QEHCj+g MDnLV+MjIHL8M1wKAoofnompn2FGGjaSCq3rgsBFN/7M6WPe+s54/wV/URE9SZr/ 5eO3v3Sb/xNh/F+Fd976xrNbn375d7+d/OG/P/r7n5e/Vn+6+vZx+MfBT279/uef fud7v3iw+dm/Pvrq/376z8++Zv/22cv/Aw== =YPw/ -----END PGP SIGNATURE----- --aT9PWwzfKXlsBJM1-- ------------------- 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