[Haskell-cafe] Need help - my haskell code is over 50 times slower than equivalent perl implementation

C K Kashyap ckkashyap at gmail.com
Tue Jun 24 16:45:22 UTC 2014


Thanks Nicholas ... you've gotten rid of unsafeInterleaveIO ...
It feels much better :)
Regards,
Kashyap


On Tue, Jun 24, 2014 at 10:08 PM, Nicolas Trangez <nicolas at incubaid.com>
wrote:

> On Tue, 2014-06-24 at 21:38 +0530, C K Kashyap wrote:
> > Dear cafe,
> >
> > I have created a reproducible app here -
> > https://github.com/ckkashyap/haskell-perf-repro
> >
> > Essentially I am trying to open a number of files and printing out their
> > sized by reading them in and computing it's length.
> >
> > I have the equivalent perl program also there. I'd appreciate it very
> much
> > if someone could take a look at my Haskell implementation and point out
> > what I am doing wrong. Since it's over 50 times slower than the perl
> code,
> > I assume I am doing something obviously incorrect.
>
> That's simply because your Haskell program is doing something completely
> different than your Perl code.
>
> Using `String` is the biggest offense. You're creating huge lists of
> `Char`s instead of working on arrays of bytes, like your Perl code does.
>
> I made some trivial changes to bring the Haskell code on par with your
> Perl code speed-wise at
>
> https://github.com/NicolasT/haskell-perf-repro/compare/ckkashyap:master...master
> Check it out!
>
> Nicolas
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140624/cf91fa91/attachment.html>


More information about the Haskell-Cafe mailing list