Recursion is not free
It takes a considerable amount of memory space (usually on the stack)
And CPU time (by using calls, rebuilding stack frames etc).
In tight loops this makes a recursive algorithm slower than its non-recursive equivalent.
If speed and stack limits are not an issue, by all means leave the recursion in, but if you use recursion in a tight loop, (which is often the case)
You gain a lot of optimization options by straitening out the recursion.
Because: maybe:
1. You don't need to save all those registers/variables
2. You don't have to jump back to the exact same place where you come from.
3. You don't need to call that cleanup code for every recursion
4. You can unroll some loops
5. You can use an inline
directive on that non-recursive routine.
My mean issue with recursion is the datastructure it most often is used on: trees.
Trees require pointers and pointers require random memory access (they jump all over the place) this is bad for cache usage because sequential access is much faster than random access.
If you replace a binary tree with an 2D array you will waste 50% of the space, (unless you stack another tree upside down in the array), but you gain sequential access options for many of the leaves and you don't have to use pointers, saving space.
Example of a binary tree stored in an array
+-----------------+
|0eeeeeeeeeeeeeeee| //no pointers needed, parent/child, is y dimension,
|11 dddddddd| //sibbling is x dimension of the array.
|2222 cccc| //The 123 tree is stored root up.
|33333333 bb| //Notice how the abc-tree is stored upside down
|4444444444444444a| //The wasted space in the middle, is offset by the fact
+-----------------+ //that you do not need up, down, and sibbling pointers.