|Keep It Simple, Stupid|
Re^4: [OT]: threading recursive subroutines.by BrowserUk (Pope)
|on Feb 03, 2011 at 09:56 UTC||Need Help??|
The point was to find a technique. Or are you saying the technique will never be as efficient as alternatives?
My point was that using memoisation, iteration or direct calculation, calculating fibonacci to the limits of the machines ability to represent the result is practical, whereas the purely recursive routine would run for an inordinate amount of time.
I'm also saying that as you can directly calculate all the representable values of Fib(n) in just over a millisecond:
But doing just the first 30 recursively takes 49 seconds (from the post above):
you'd need 50,000 threads and perfect efficiency gains to allow a parallelised recursive routine to calculate those first 30 in the same time that the direct calculation does the first 1474.
Basically, I don't believe you could ever match the efficiency of teh direct calculation no matter if you could throw millions of threads at the problem.
As far as I know, one can't make ...parallel without refactoring by a human, yet the Ackermann function is of that form.
Actually, I think that you are pretty much exactly the same point as I am.
You see that there is some scope for parallelising Ackermann, but you don't see how to do it.
There are obviously great tranches of intermediate results that need to be calculated. For Ackermann( 3, 15 ) there are 655365 intermediate results. It seems inconceivable (to me) that there isn't scope for splitting this work across my 4 cores.
Of course, you can memoise Ackermann and it does effect a good speed-up, but the memory used gets huge very quickly, which makes it impractical as a generic solution. This is true for many similar algorithms.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.