in reply to Re: Recursion Alternatives?
in thread Recursion Alternatives?
Recursion is slow because all the arguments must be pushed onto the stack (in the case of Perl, the @_ variable). By eliminating any arguments passed in a recursive algorithm, you eliminate the speed problem, since nothing needs to be pushed onto the stack.
The example above probably isn't the best example of this, since $iGlobal still needs to be shifted off the stack.
----
Reinvent a rounder wheel.
Note: All code is untested, unless otherwise stated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Recursion Alternatives?
by Abigail-II (Bishop) on Feb 27, 2003 at 16:28 UTC | |
|
Re: Re: Re: Recursion Alternatives?
by no_slogan (Deacon) on Feb 27, 2003 at 15:44 UTC | |
by demerphq (Chancellor) on Mar 03, 2003 at 16:41 UTC | |
by no_slogan (Deacon) on Mar 03, 2003 at 20:52 UTC | |
by demerphq (Chancellor) on Mar 04, 2003 at 10:10 UTC | |
by no_slogan (Deacon) on Mar 04, 2003 at 21:06 UTC |