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 XAA18855; Fri, 23 Jul 2004 23:45:03 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA16732 for ; Fri, 23 Jul 2004 23:45:02 +0200 (MET DST) Received: from mynah.mail.pas.earthlink.net (mynah.mail.pas.earthlink.net [207.217.120.228]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6NLj0EV026132 for ; Fri, 23 Jul 2004 23:45:01 +0200 Received: from 65-101-178-81.tcsn.qwest.net ([65.101.178.81] helo=dylan) by mynah.mail.pas.earthlink.net with asmtp (Exim 4.34) id 1Bo7qb-0002UU-Ud; Fri, 23 Jul 2004 14:44:58 -0700 Message-ID: <003a01c470fe$72ba90d0$0201a8c0@dylan> From: "David McClain" To: "Brandon J. Van Every" , "caml" References: Subject: Re: [Caml-list] Bigarray is a pig Date: Fri, 23 Jul 2004 14:45:56 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-ELNK-Trace: 7a0ab3eafc8cf994b22988ad1c62733440683398e744b8a462623e6cd6ea0aacd4c5ac9dd405a90a667c3043c0873f7e350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 65.101.178.81 X-Miltered: at nez-perce with ID 410186DC.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; mcclain:01 dmcclain:01 caml-list:01 natively:01 unboxed:01 finalization:01 runtime:01 misses:01 mcclain:01 arrays:01 arrays:01 bigarray:01 unsafe:01 unsafe:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I hesitate to tell you this, but have a look at my Foreign Arrays code and you will see direct access at all times from OCaml. However, in order to achieve this you have to commit to some very dangerous practices! For example, OCaml only knows natively how to access unboxed contiguous arrays of double precision. So when you need to see a foreign array directly from OCaml it must first be converted to this format. That's okay, not dangerous, just a potentially massive overhead on the first reference. Secondly, the dangerous part comes in accessing the so-called Arena of the array to direct and unsafe access from OCaml. No bounds checking here. No function calls to each element either. The array can't move on you during GC because it is foreign. (recent updates in my possession now conform to the more modern Custom_tag blocks, up from the older Finalization blocks. So these are now directly compare'able, hashable, and streamable, in addition to being finalizable.) With honorable respect to Xavier and the INRIA team, I did this purely for myself, while breaking a ton of other OCaml cherished ideals as well. It works well for me in my numerical modeling language, but the language is explicitly unsafe. It never bombs out, mind you, but it does accept and compile statements of utter nonsense that produce runtime errors on the console, asking you to repeat what you said, but in a different manner... As one respondent put it, a call is quick, and a cache miss is horrible by comparison. You will actually generate quite a few cache misses if your array has any significant size to it. Cheers, David McClain Senior Corporate Scientist Avisere, Inc. +1.520.390.7738 (USA) david.mcclain@avisere.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