Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You are probably thinking of tail-call optimization, which is when a recursive function returns the result of calling itself as its last action. These algorithms and functions are called tail-recursive.

Compilers and interpreters can (more easily) optimize tail-recursive algorithms to avoid the normal cost of creating a new stack frame and making a normal function call, which means the recursive algorithm has performance more like that of an iterative implementation.

https://en.wikipedia.org/wiki/Tail_call

https://llvm.org/docs/CodeGenerator.html#tail-call-optimizat...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: