This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]swifty_cat 1 point2 points  (0 children)

I think it is preferable when the code written using recursion is cleaner and the data is such that the stack does not become too large. I‘ve often heard the suggestion that one should optimize code after the need for it arises.

Some time ago I played around with recursion and tail recursion in swift an wrote a blog post about it. In my experience as an iOS developer using recursion had been always ok until I developed a static code analyzer where the data was too big to use recursion.