[Haskell-cafe] Fast sorting with Bytestring

Ketil Malde ketil at malde.org
Wed Jun 18 14:56:43 EDT 2008

Stefan O'Rear <stefanor at cox.net> writes:

>> Ok, strane ... Well, let's test with some 'normal' text:
>> time ./sort < bible > /dev/null       # ~  0.4   s
>> time sort < bible > /dev/null         # ~  0.56  s

>> Ok, not that different. But with Haskell you often expect to get very
>> slow code compared to an implementation in C.

> GNU 'sort' uses an external sort algorithm.  You can, with 200M of
> memory, give it a 50G input file, and it will work.  This might explain
> the difference..

GNU sort also handles locale-based comparison, which I suspect
explains more of the difference.  Try with LC_ALL=C.

If I haven't seen further, it is by standing in the footprints of giants

More information about the Haskell-Cafe mailing list