[Haskell-cafe] how to make it faster ?

Ivan Miljenovic ivan.miljenovic at gmail.com
Wed Mar 24 01:05:59 EDT 2010


On 24 March 2010 16:01, 国平张 <zhangguoping at gmail.com> wrote:
> Hi,
>
> I wrote a type program to compute fibonacci series, if the max value
> is big, then it becomes very slow.
> like
>
> take 100 fib
>
> How can I make it faster :-)

Use a better algorithm: http://tinyurl.com/ya3vvye

Try doing your code by hand for say "fibo 5" to see why it's so bad
(hint: GHC does not do CSE in general).

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list