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 AAA19328; Sat, 24 Jul 2004 00:01:01 +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 AAA19556 for ; Sat, 24 Jul 2004 00:01:00 +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 i6NM0xEV031194 for ; Sat, 24 Jul 2004 00:00:59 +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 1Bo866-00085s-LS; Fri, 23 Jul 2004 15:00:58 -0700 Message-ID: <004601c47100$ae9f9850$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 15:01:54 -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: 7a0ab3eafc8cf994b22988ad1c62733440683398e744b8a4eacca4e9d926371e896a302d32a25a8c2601a10902912494350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 65.101.178.81 X-Miltered: at nez-perce with ID 41018A9B.000 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 mcclain:01 arrays:01 arrays:01 bigarray:01 unsafe:01 unsafe:01 ocaml:01 ocaml:01 face:98 believing:98 float:02 compile:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Sorry for letting my mind run ahead of my typing... What I meant to say previously about danger, is that despite the foreign arrays being safe from GC disruption, in order to access the arena of these arrays you have to trick OCaml into believing that it is seeing one of its own kind of array. That arena address is a foreign pointer address, but this is potentially unsafe in the face of GC because the foreign array does not actually have the require structure to pass as an OCaml array of float. So you have to take care never to allocate anything in the heap during arena accessing. That is also why the only permitted access to the array arena is by means of unsafe_get and unsafe_put. You have to be unsafe to be safe... er, yeah... But it is very fast! It compile to direct memory reference inside the loops. 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