[Haskell-cafe] Fast sorting with Bytestring

Georg Sauthoff gsauthof at TechFak.Uni-Bielefeld.DE
Wed Jun 18 14:38:34 EDT 2008


On Wed, Jun 18, 2008 at 11:23:00AM -0700, Stefan O'Rear wrote:
> 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..

But the input files are both < 10 mb ...

If I create a 'big_bible' file like 'cat bible bible | dd
of=big_bible count=1 bs=SIZE_OF_BRACKETS' then the timings are:

time sort < big_bible > /dev/null     #  ~ 1.2 s
time ./sort < big_bible > /dev/null   #  ~ 0.8 s

I.e. the difference here is like a low constant factor, and not like a factor
of 1000 with the brackets.

Best regards
Georg Sauthoff
-- 
Fortune : 'Real programmers don't comment their code.
           It was hard to write, it should be hard to understand.' ;)


More information about the Haskell-Cafe mailing list