[Haskell-cafe] How To Make It Faster?

Magnus Therning magnus at therning.org
Wed Jun 10 06:24:01 EDT 2009


On Wed, Jun 10, 2009 at 10:11 AM, <paravinicius at yahoo.com.br> wrote:
> Hi,
>
> I come up with the following solution for this spoj problem (warning!):
>
> problem:  https://www.spoj.pl/problems/ARITH2/
> solution: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5720#a5720
>
> I'd like to make it run faster, if possible. What should I do to
> identify the bottlenecks and once I find them, a few guidelines to
> actually fix them.
>
> Thanks in advance,

My profiling-fu is rather weak, but I think about 40% of the time is
spent on reading from stdin, about 17% on splitting that into lines
and then words.  Only about 10% is spent in arith_expression and 8% in
the lambda you pass into forM.

I don't have any suggestions for actually speeding it up, but
profiling helps in concentrating your efforts. :-)

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe


More information about the Haskell-Cafe mailing list