So I know this has been discussed before, and there's a wiki article on it, but I wanted to get some more opinions. Pros and cons anyone?
From my testing, aside from the recursion limits discussed in the wiki article (which is actually lower for x64 EXEs, 1898 IIRC), I didn't notice any performance difference. I tested returning arrays of all files and folders on my C: drive, and both versions were nearly identical at just under 9 seconds. To boot, there's no way that recursion limit was anywhere near being reached.
As an exercise I converted the recursive functions in my _SecureDelete UDF and some of my other projects to iterative versions, and came up with the below.
Iterative Pros:
- simpler handling of one-time tasks such as function initializations, parameters, and error handling/recording
Cons:
- can result in significantly longer and more complex code (see the _SecureDelete update I just posted, took more code and a clever idea to keep memory usage down while traversing directory trees)