5 ms·
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 thi
by Beltiras 4y 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.
- Retr0id 4y agoHow does this relate to tail calls?
- Beltiras 4y agoTail calls have a collector that accumulates the result, very similar pattern as in the example. It's an optimization in LISP and similar languages.
- readams 4y agoTail 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.
- lvass 4y agoAt 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.