3 ms·
How does tail call optimization cause a regress in performance? Superficially, it seems very counter-intuitive that this should even be possible.
by j_jochem 10y ago
How does tail call optimization cause a regress in performance? Superficially, it seems very counter-intuitive that this should even be possible.
- pizlonator 10y agoIt's not a performance regression in JSC. Maybe the other implementations aren't as good as JSC's.
- munificent 10y agoShots fired.
- __s 10y agoMesses with calling conventions. Citing Rust: https://mail.mozilla.org/pipermail/rust-dev/2013-April/003557.html https://mail.mozilla.org/pipermail/rust-dev/2013-April/00355...
- pizlonator 10y agoI agree that it messes with calling conventions. This is a problem for AOT languages, where binary compatibility is paramount and so you cannot change the calling convention. Since tail calls don't play well with existing native conventions, they end up being hard (or sometimes even impossible) to implement. That's not really an issue in JS or other VM-based languages. JS VMs don't make their internal calling conventions public. In JSC, our old calling convention was incompatible with PTC, so we changed our calling convention to make PTCs work.
- astrange 10y agoGCC/Clang can generate code with tail calls, if you don't mind losing the stack frame. And I don't think they have any issue tail-calling external libraries on the ABIs I know. How are these different?
- steveklabnik 10y agoIt's worth noting that's from 2013; in my understanding, things have changed in LLVM since then, which was another big blocker.