Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] using BigArray to mmap huge binary file
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-11-09 (18:48)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] using BigArray to mmap huge binary file
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.

Depends a lot on what format your data is in.  Ours is stored as a
huge array of 16-bit signed ints and Bigarray supports that naturally.
If your data was in an unsupported format, or if it wasn't strictly an
array, you might end up doing contortions.


Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology -
Internet Marketing and AdWords courses - - NEW!
Merjis blog - - NEW!