[Haskell-beginners] Performance of parallel mergesort

Jon Harrop jon at ffconsultancy.com
Sat Dec 26 14:44:36 EST 2009

On Thursday 24 December 2009 09:09:41 Tom Davie wrote:
> Here's my results on a dual core running OS X:
> LappyBob:~ tatd2$ time ./test +RTS -N1
> -0.117109518058233
> real 0m4.608s
> user 0m4.400s
> sys 0m0.189s
> LappyBob:~ tatd2$ time ./test +RTS -N2
> -0.117109518058233
> real 0m3.648s
> user 0m6.360s
> sys 0m0.220s
> LappyBob:~ tatd2$ time ./test +RTS -N3
> -0.117109518058233
> real 0m50.679s
> user 1m24.235s
> sys 0m0.620s

Here are my results on a dual quad-core:

$ ghc-6.10.4 --make -O2 -threaded mergesort.hs -o mergesort
[1 of 1] Compiling Main             ( mergesort.hs, mergesort.o )
Linking mergesort ...
jdh30 at leper:~/Programs/mine/haskell/mergesort$ time ./mergesort 
+RTS -K100000000 +RTS -N1

real    0m7.664s
user    0m7.528s
sys     0m0.136s
$ time ./mergesort +RTS -K100000000 +RTS -N2

real    0m7.224s
user    0m9.773s
sys     0m0.108s
$ time ./mergesort +RTS -K100000000 +RTS -N3

real    0m7.293s
user    0m11.637s
sys     0m0.168s
$ time ./mergesort +RTS -K100000000 +RTS -N4

real    0m7.333s
user    0m12.689s
sys     0m0.360s
$ time ./mergesort +RTS -K100000000 +RTS -N5

real    0m7.449s
user    0m14.757s
sys     0m0.548s
$ time ./mergesort +RTS -K100000000 +RTS -N6

real    0m7.043s
user    0m14.985s
sys     0m0.252s
$ time ./mergesort +RTS -K100000000 +RTS -N7

real    0m8.018s
user    0m19.325s
sys     0m1.012s
$ time ./mergesort +RTS -K100000000 +RTS -N8

real    0m55.963s
user    5m55.654s
sys     0m1.492s

As you can see, there is still no significant speedup from parallelism.

Dr Jon Harrop, Flying Frog Consultancy Ltd.

More information about the Beginners mailing list