[Haskell-cafe] External Sort and unsafeInterleaveIO

Donald Bruce Stewart dons at cse.unsw.edu.au
Tue Jul 17 23:54:25 EDT 2007


midfield:
> hi --
> 
> thanks for the useful comments!  i will definitely go through them
> carefully.  unfortunately for this code (but fortunately for me) i
> defend my dissertation on monday so i'm a little distracted right
> now.....
> 
> i'm more than happy to donate this code or whatever improvements
> happen to it.  actually, hGetContentsWithCursor seems like a candidate
> for inclusion with Data.ByteStrings or Data.Binary or something -- it
> seems like it might find other uses.  (i think you liked that bit of
> code because i ripped it off of you guys!  it's very short hamming

Can't fault that style ;)

> distance from the original.)  anyhow, all that will have to wait a
> couple weeks or so.  also i've never cabalized anything so i may come
> begging for help.

We have a tutorial for that, luckily:

    http://haskell.org/haskellwiki/How_to_write_a_Haskell_program

And a tool to automate it, mkcabal, so should be fairly straightforward.

> 
> at some point i thought i saw how to do recursive external sort, to
> keep memory usage truly constant, but with my current lack of sleep i
> have lost that illusion.  i'm also curious about the performance
> characteristics of this vs Prelude sort vs the version using the
> tournament mergesort apfelmus suggested.  i need to find a computer
> with a lot more RAM than my weakling laptop.  finally, it would be
> good to be able to have the blocksize controlled by Kb of RAM rather
> than # of elements, not sure how to get that information.
> 
> ultimately this was part of my project to write lucene for haskell.  i
> think with this out of the way, plus all the Data.Binary / ByteString
> goodness, it shouldn't take too long.  keep writing good libraries for
> me!
> 

Great. Good to see things working. 

-- Don


More information about the Haskell-Cafe mailing list