[Haskell-cafe] External Sort and unsafeInterleaveIO
stefanor at cox.net
Sat Jul 21 23:53:09 EDT 2007
On Tue, Jul 17, 2007 at 04:16:29AM -0500, Ben wrote:
> hi folks --
> a haskell newbie here, searching for comments and wisdom on my code.
> i had a project to try to implement "external sort" in haskell as a
> learning exercise. (external sort is sorting a list that is too large
> to fit in main memory, by sorting in chunks, spooling to disk, and
> then merging. more properly there probably should be multiple stages,
> but for simplicity i'm doing a one-stage external sort.)
If you have practical (as opposed to pedagogical) reasons for this, you
should try using 'sort' from GNU coreutils (standard sort on linuxen,
shouldn't be terribly hard to make work on other systems if you know C).
The inner loop is coded with pretty bad constant factors, but it *is* an
external sort, and has happily sorted 20GB files on my (300MB core)
system; only taking an hour.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070721/ddd9d23b/attachment.bin
More information about the Haskell-Cafe