Removing recursion via explicit callstack simulation
gsky
12 points
2 comments
March 10, 2026
Related Discussions
Found 5 related stories in 87.3ms across 8,303 title embeddings via pgvector HNSW
- Surpassing vLLM with a Generated Inference Stack lukebechtel · 31 pts · March 10, 2026 · 42% similar
- Redesigning the Recurse Center application to inspire curious programmers nicholasjbs · 63 pts · April 24, 2026 · 42% similar
- Show HN: Kstack – Skill pack for monitoring/troubleshooting K8s in Claude Code andres · 19 pts · May 07, 2026 · 40% similar
- Ministack (Replacement for LocalStack) kerblang · 183 pts · March 31, 2026 · 39% similar
- Retrofitting JIT Compilers into C Interpreters ltratt · 65 pts · April 15, 2026 · 39% similar
Discussion Highlights (2 comments)
juancn
It can be done mechanically, it's essentially what a compiler does. But yeah, it can be a useful technique, specially when there's tail recursion and the explicit stack just vanishes and the recursion turns into a plain old loop which the hardware just loves.
Panzerschrek
While coding recursive algorithms in C++ and Rust I have found, that they have some overhead due to performing recursive calls. Compilers can't inline such calls (with exception of tail-recursion). So, replacing recursion with manually-managed stack gives some performance boost. I am wondering why no major C++ compiler can do this for me automatically.