osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What make function with huge list so slow


> Figure out how much memory fib_dp is holding on to right before it returns
> the answer.  fib(400000) is a _big_ number!  And so is fib(399999), and
> fib(399998), and fib(399997), etc.  By the time you're done, you're holding
> on to quite a huge pile of storage here.  Depending on how much physical
> memory you have, you much actually be swapping before you're done.
>
> --
> Alan Bawden
> --
>
T
Thank you Alan. You are right! we use too much memeoy to save the answer in
the dp list. Now I get it, thank you so much.