From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id D65B6BC69 for ; Thu, 9 Nov 2006 20:12:06 +0100 (CET) Received: from comtv.ru (comtv.ru [217.10.32.17]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id kA9JC5eJ004241 for ; Thu, 9 Nov 2006 20:12:06 +0100 X-UCL: actv Received: from av1474.oops ([10.0.66.9] verified) by comtv.ru (CommuniGate Pro SMTP 4.1.8) with ESMTP id 3338779; Thu, 09 Nov 2006 22:11:52 +0300 Date: Thu, 9 Nov 2006 22:12:11 +0300 (MSK) From: malc X-X-Sender: malc@home.oyster.ru To: Richard Jones Cc: =?iso-8859-1?Q?D=E1rio?= Abdulrehman , caml-list@yquem.inria.fr Subject: Re: [Caml-list] using BigArray to mmap huge binary file In-Reply-To: <20061109184748.GA7016@furbychan.cocan.org> Message-ID: References: <6aeedf580611091030n30ddd9ddjdce831076761bc3@mail.gmail.com> <20061109184748.GA7016@furbychan.cocan.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at concorde with ID 45537D85.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; malc:01 bigarray:01 bigarrays:01 ocaml:01 compares:01 ocaml:01 bigarray:01 indirections:01 pointer:01 -unsafe:01 rio:98 vale:98 wrote:01 wrote:01 caml-list:01 On Thu, 9 Nov 2006, Richard Jones wrote: > On Thu, Nov 09, 2006 at 06:30:50PM +0000, D?rio Abdulrehman wrote: >> I have a huge binary data file that I would like to memory map for intensive >> reading (no writing) with the best possible performance. >> I read some discussions about using BigArrays to achieve this in Ocaml. I >> would like to know how this solution compares with the C language mmap. >> Please bear in mind I am a total newbie to Ocaml but I have good Common Lisp >> experience. > > We use Bigarray to map geographical data. It works. As far as I'm > aware ArrayX.map_file is really just a wrapper around mmap, and read > accesses are just indirections on a pointer. I beg to differ, to the best of my knowlege every reference to bigarray is bounds checked, even with -unsafe. So, while map_file does indeed look like a wrapper around mmap, read/write is a bit more than an indirected memory fetch. -- vale