Tj
Posts: 7
Nickname: tj
Registered: Jan, 2003
|
|
Re: Recursion versus iteration
|
Posted: Jan 27, 2003 11:14 PM
|
|
Java runtimes don't currently optimize recursive structures, I believe. Iteration will pretty much always be a win, if you care for performance and stability (since Java has limits to recursion). But you could prototype using recursion, since it's generally a clearer way of writing things. Then convert to iteration.
I've used recursion when I knew for a fact that I wouldn't be dealing with deep trees. Then all I cared was writing a bug-free, clear version. If profiling later told me there was a problem, then I would have converted to iteration. Fortunately, there was absolutely no problem.
|
|