Alex Ferguson wrote:
> 
> Tony Davie:
> > And anyway didn't this start out about how to do I/O on binary data.
> 
> To be honest, I'm not sure this discussion does necessarily address
> the original query:
> 
> Steve Roggenkamp:
> > I would like to use Haskell for several larger scale projects, but I
> > can't figure out how to read and write binary data.
> 

I'm not sure that it has.  I haven't saved every message, but it appears
I could use a Native class from ghc.  I've not tried this yet.  Chapter
7 of the Haskell 1.4 Report appears to deal with character I/O only and
I can't find any binary I/O operations in the library.

> Steve, can you clarify what sort of binary file manipulation it is you
> are actually looking for, and whether the thread so far has answered
> your question (either in the positive, or the negative)?
> 

I currently working on a database which consists mainly of integers.  I
have to search large arrays of these integers which may contain over a
hundred million entries.  With this amount of data I'm looking at ways
to compress it to a minimum amount of physical space.  I also do not
want to have to parse a string to read in an integer.  Both
computational performance and space would suffer too much.  Thus the
need for storing binary data.

The major performance determinant appears to be the speed of the disk
drive.  Most disk drives can only deliver about 100-125 blocks/sec when
randomly accessing offsets in a file.  So I need to be careful about
which disk blocks I access.  Even with 250 million entries, I can find a
single entry in less than 30 disk I/Os by using binary search, so I
could conduct about three of these searches per second, assuming no help
from the disk cache.

I have considered using `mmap', but I think the database will eventually
outgrow the address space of a single process.

> Though in any case, I do agree that the whole persistency area is an
> alarmingly open one wrt Haskell, and the discussion has merit for its
> own sakes.  Yoshihiko Ichikawa's request for clarification was also
> rather to the point; we're in danger of covering the whole of a very
> broad and somewhat diffuse subject area -- possibly by a search algorithm
> reasonably characterisable as a species of Drunkard's Walk ;-)
> 
> Slainte,
> Alex.

Steve

-- 
-----
Steve Roggenkamp
InterNet:    [EMAIL PROTECTED]
Address:     9159 Eversole Run Road
             Powell, OH  43065  USA
Phone:       614.873.6573
WWW:         http://www.infinet.com/~sroggen/home.html


Reply via email to