|
|
|
|
|
by Spivak
465 days ago
|
|
The fact that call depth is finite should basically kill the use of recursion in every codebase in favor of an explicit stack data structure. They're better in every way except as a way to confuse new CS students by hiding the very much lack of magic that underpins them. You don't have stack frame overhead, you can nest arbitrarily, they'll always be more performant. You can peek into the stack to do things recursive functions can't. The optimizer is better at helping you with loops, memoization just becomes a normal cash of intermediate results. |
|