The performance would very much depend on what you are doing in your recursive function. For the trivial task of computing tree depth presented here, where all overhead is in the recursion itself (or the techniques you use to work around it), it would be several times slower than the recursion (if you can actually make recursion to work to compare them). For non-trivial tasks this would be a different story. If you care about performance, you must measure your specific problem. But even in sports programming setting, with small recursive functions, I’ve successfully used this coroutines-based framework several times, which allowed me to write short, easy to understand code that actually worked and passed the tests in the allotted time limit as opposed to lots of code I would have had to write to work around recursion otherwise.