3 ms·
This is exactly the kind of content I love to see on HN. But I wonder though how this optimization is related to tail-call optimization? How the interpreter jum
by bjourne 2y ago
This is exactly the kind of content I love to see on HN. But I wonder though how this optimization is related to tail-call optimization? How the interpreter jump table is implemented shouldn't affect how stack frames are created, should it?
- mbel 2y agoIt's explained under the first link from the article [0]: "A new type of interpreter has been added to CPython. It uses tail calls between small C functions that implement individual Python opcodes, rather than one large C case statement." [0] https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-tail-call https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-...
- ambivalence 2y agoA big chunk of the performance gain comes from the fact that with tail calls the CPU doesn't have to reset the registers (configured through the `preserve_none` calling convention).
- thunkingdeep 2y agoWell if you’d bother to read it, you’d discover this is about tail calls in C, not in Python. It has nothing to do with tail recursion in Python. Guido has explicitly said that Python will never have it.