[Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

Ivan Salazar ivan.salazarv at gmail.com
Thu Nov 29 20:17:24 CET 2012

I hear you, my friend.

What I love of Haskell is that a lot of algorithms are very clean to
express and understand compared to, say, Lisp or C. Compared to Lisp,
function manipulation is also very clean (even compared to Racket). A great
plus is also type inference.

The bad side is that direct translation of algorithms are almost always
very slow and the work needed to make them perform is very mind bending. I
sometimes feel as if I am doing the work of a compiler/optimizer and wonder
if a computer program can do this translations.

In the correct hands (the Simons, Don Stewart, etc) I am sure Haskell is a
killer, but in hands of lowly, imperative mortals it is a time bomb. A good
example of this is narrated in Clarke's

I am a total Haskell newbie, so please ignore me if my opinion sounds
stupid, but I think I read once that Peyton-Jones said that the Haskell of
the future will be strict.


2012/11/29 Fixie Fixie <fixie.fixie at rocketmail.com>

> Hi all haskellers
> I every now and then get the feeling that doing my job code in Haskell
> would be a good idea.
> I have tried a couple of times, but each time I seem to run into
> performance problems - I do lots of heavy computing.
> The problem seems to be connected to lazy loading, which makes my programs
> so slow that I really can not show them to anyone. I have tried all tricks
> in the books, like !, seq, non-lazy datatypes...
> I was poking around to see if this had changed, then I ran into this forum
> post:
> http://stackoverflow.com/questions/9409634/is-indexing-of-data-vector-unboxed-mutable-mvector-really-this-slow
> The last solution was a haskell program which was in the 3x range to C,
> which I think is ok. This was in the days of ghc 7.0
> I then tried compile the programs myself (ghc 7.4.1), but found that now
> the C program now was more that 100x faster. The ghc code was compiled with
> both O2 and O3, giving only small differences on my 64-bit Linux box.
> So it seems something has changed - and even small examples are still not
> safe when it comes to the lazy-monster. It reminds me of some code I read a
> couple of years ago where one of the Simons actually fired off a new
> thread, to make sure a variable was realized.
> A sad thing, since I am More that willing to go for Haskell if proves to
> be usable. If anyone can see what is wrong with the code (there are two
> haskell versions on the page, I have tried the last and fastest one) it
> would also be interesting.
> What is your experience, dear haskellers? To me it seems this beautiful
> language is useless without a better lazy/eager-analyzer.
> Cheers,
> Felix
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121129/cef2ac69/attachment.htm>

More information about the Haskell-Cafe mailing list