r/ProgrammerHumor • • 2d ago

Meme howProgrammingHasChanged

Post image
565 Upvotes

101 comments sorted by

View all comments

311

u/torsten_dev 2d ago

Both have terrible stack usage.

145

u/temperamentalfish 1d ago

Yeah I'm cringing at all the recursive solutions. Huge stack and so much repeated work. Just try counting how many times fib(5) would be executed to calculate fib(10). It's so often the go-to example for recursion and it's frankly terrible.

3

u/BitTwiddles 22h ago

Write it in Erlang with tail recursion. In fact fib is the common demonstration case for recursion.