How to make reading an array from disk more efficient

Hal Daume III hdaume at ISI.EDU
Wed Dec 24 14:40:33 EST 2003


one other thing you might find useful is to read it imperatively and then 
use unsafeFreezeArray (i think that's the name) to get a pure array out of 
it.  since all you'll be doing is reading, this should work nicely for 
you.

On Wed, 24 Dec 2003, andrew cooke wrote:

> 
> Thanks.  I should have added that I will only use the array for reading
> once it's created.  I don't mind whether creating is lazy or eager (it's
> currently eager because I was fighting a space leak, but I think that was
> down to some other error).
> 
> I don't fully understand how either of the suggestions you make will speed
> up creation, though (I guess allocating less memory is faster).  I'm
> looking for a factor of tens of thousands improvement.  But I will try
> what you suggest.
> 
> Cheers,
> Andrew
> 
> PS Thanks for the very speedy reply and thanks to whoever maintains the
> list archive for updating the archive for each message (I'm pretty sure it
> used to be made daily, which was a nuisance if you wanted to forward URLs
> to interesting discussions).
> 
> Hal Daume III said:
> > (1) use unboxed arrays, otherwise you're wasting too much space with
> > pointers.  that is, unless you need laziness on the elements, which i
> > don't think you do based on your list
> >
> > (2) (maybe) use imperative arrays; this will help you ensure that
> > everything is being evaluated quickly.
> 
> 

-- 
 Hal Daume III                                   | hdaume at isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume



More information about the Haskell mailing list