Removing recursion via explicit callstack simulation
gsky
12 points
2 comments
March 10, 2026
Related Discussions
Found 5 related stories in 38.7ms across 3,471 title embeddings via pgvector HNSW
- Surpassing vLLM with a Generated Inference Stack lukebechtel · 31 pts · March 10, 2026 · 42% similar
- Ministack (Replacement for LocalStack) kerblang · 183 pts · March 31, 2026 · 39% similar
- Zstandard Across the Stack oddurmagnusson · 14 pts · April 02, 2026 · 39% similar
- Show HN: Vanilla JavaScript refinery simulator built to explain job to my kids fuelingcurious · 93 pts · March 11, 2026 · 39% similar
- Code-review-graph: persistent code graph that cuts Claude Code token usage tirthkanani · 11 pts · March 09, 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.