Hacker News new | ask | show | jobs
by Beltiras 1478 days ago
Is the implication here that tail call optimizations don't work anymore? They might seem to do the proper thing on the language level but the CPU just can't think that way.
2 comments

Tail calls will work the same as loop. So if you have data dependencies between loop iterations or between tail-call-eliminated stack frames, then it will be slower than if you do not have those dependencies.
At least in some languages like Elixir and probably most FP languages, tail calls are practically only used when said dependencies exist, so their usage can perhaps be a marker for when some optimizations are not possible.
How does this relate to tail calls?
Tail calls have a collector that accumulates the result, very similar pattern as in the example. It's an optimization in LISP and similar languages.