How to Catch Recursion by the Tail
summary
Examines whether and how tail-recursive calls can be converted into loops on the JVM: why tail-call elimination is useful, which Java virtual machines (and whether it’s legal) perform such transformations, and what third-party tools can help optimize functional-style Java code. Also compares JVM-friendly functional languages such as Scala and Kotlin that provide stronger support for tail-recursion.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 1:50Recursion stack overflow
- 4:15Tail recursion with accumulator
- 6:06Tail call optimization basics
- 8:15Manual optimization pitfalls
- 10:22Identifying tail recursion
- 12:36Virtual method calls and recursion
- 15:30Bytecode-level optimization
- 21:57Language support for tail recursion
- 24:26Scala and Kotlin approaches
- 28:43Logical operators and recursion
- 31:59Critique of Kotlin and Scala
- 33:26Virtual call optimization
- 36:33Virtual machine role in optimization
- 41:51Performance benchmarks
- 49:02Stack traces and debugging
- 53:42Stack depth and performance
- 55:49HotSpot exception handling
- 58:00Recommendations
- 59:07Q&A
