Tail Call Optimization: The Musical!!
summary
Demonstrates that a JavaScript engine with Tail Call Optimization actually reclaims stack frames so a tail‑recursive function can run tens of thousands of calls without throwing Maximum call stack size exceeded the demo rewrites a naive recursive routine into an accumulator style with a nonrecursive wrapper to make it tail‑recursive, flips the TCO switch and runs ~10,000 calls successfully, noting the tradeoff of losing intermediate stack trace information.
AI-written summary · about
chapters (3)
related talks
36mRecursion, Iteration & JavaScript: A love story
01h 04mRecursion has never been invented: A tale of intrigue
38mRecursion, Iteration, and JavaScript A Love Story
29mExtreme JavaScript Performance
25mJavaScript engines how do they even?
32mV8 by example: A journey through the compilation pipeline
31mJavaScript Compilation Techniques or "Wasn't JavaScript supposed to be slow?"
39mAlgorithms in the Front End: from V8 to VDOM
