3 ms·
The purpose of `@tailrec` is not necessarily for performance, but more for correctness, otherwise you can end up with recursive functions that blow up the stack
by bad_user 12y ago
The purpose of `@tailrec` is not necessarily for performance, but more for correctness, otherwise you can end up with recursive functions that blow up the stack pretty fast on large enough inputs. Plus this benchmark only does at most 20 iterations per loop - which means nothing if you want to measure the cost of method calls.
- chton 12y agohmm that's a very good point, I didn't consider that. We'd need additional benchmarking to know what the actual impact is and at what point the @tailrec version becomes more desirable.