[Haskell-cafe] performance question

Nicolas Bock nicolasbock at gmail.com
Fri Feb 8 20:26:09 CET 2013


Hi list,

I wrote a script that reads matrix elements from standard input, parses the
input using a regular expression, and then bins the matrix elements by
magnitude. I wrote the same script in python (just to be sure :) ) and find
that the python version vastly outperforms the Haskell script.

To be concrete:

$ time ./createMatrixDump.py -N 128 | ./printMatrixDecay
real    0m2.655s
user    0m2.677s
sys     0m0.095s

$ time ./createMatrixDump.py -N 128 | ./printMatrixDecay.py -
real    0m0.445s
user    0m0.615s
sys     0m0.032s

The Haskell script was compiled with "ghc --make printMatrixDecay.hs".

Could you have a look at the script and give me some pointers as to where I
could improve it, both in terms of performance and also generally, as I am
very new to Haskell.

Thanks already,

nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130208/cae18291/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: printMatrixDecay.hs
Type: application/octet-stream
Size: 2020 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130208/cae18291/attachment.obj>


More information about the Haskell-Cafe mailing list