Łukasz Langa
👤 PersonAppearances Over Time
Podcast Appearances
Cool.
Cool.
Right. So the JIT is still one of those other topics that I remember being this big pipe dream of CPython for as long as I can remember. We grew a few attempts to have a JIT in forks of Python or entirely new Python interpreters. Most of those efforts failed. There's one holdout that is actually doing very well. That's PyPy.
Right. So the JIT is still one of those other topics that I remember being this big pipe dream of CPython for as long as I can remember. We grew a few attempts to have a JIT in forks of Python or entirely new Python interpreters. Most of those efforts failed. There's one holdout that is actually doing very well. That's PyPy.
And that is actually JITed, which proves that this language can successfully use this performance strategy for good results.
And that is actually JITed, which proves that this language can successfully use this performance strategy for good results.
Yes, it is an entirely separate technological stack. It is attempting to be bug-to-bug compatible with CPython. People adopting it have seen, your mileage may vary sort of results where it might be really a drop-in replacement in some cases. It might be more tricky to actually adopt it otherwise.
Yes, it is an entirely separate technological stack. It is attempting to be bug-to-bug compatible with CPython. People adopting it have seen, your mileage may vary sort of results where it might be really a drop-in replacement in some cases. It might be more tricky to actually adopt it otherwise.
Plus the approach of Jiting they're using has some characteristics with memory usage being larger and so on. So it depends on your use case. But obviously the most popular version of Python is CPython is the version that we are working on. So this is an idea that just comes back and comes back and comes back. Like when will... Python have a just-in-time compiler.
Plus the approach of Jiting they're using has some characteristics with memory usage being larger and so on. So it depends on your use case. But obviously the most popular version of Python is CPython is the version that we are working on. So this is an idea that just comes back and comes back and comes back. Like when will... Python have a just-in-time compiler.
So to a large approximation, if you squint really hard, this specialization that Pablo already mentioned is sort of slowly becoming a form of what digits are doing, which is to remove all this indirection.
So to a large approximation, if you squint really hard, this specialization that Pablo already mentioned is sort of slowly becoming a form of what digits are doing, which is to remove all this indirection.
But the last step that they did not take so far, those optimizations, is to actually replace running this C code with this C code with an actual compilation to machine code as we go dynamically, which is what the JIT is doing. And Brandt Bucher, one of our core team members, found out this paper about how you can automatically generate a JIT
But the last step that they did not take so far, those optimizations, is to actually replace running this C code with this C code with an actual compilation to machine code as we go dynamically, which is what the JIT is doing. And Brandt Bucher, one of our core team members, found out this paper about how you can automatically generate a JIT
for the Lua interpreter and how it is slower than a handwritten JIT, but not by that much as you would expect, and it is much more maintainable. And using this approach with this additional machinery that is needed for the just-time compiler that tries to compile during our build time, like the simple opcodes that are later glued together to this JIT,
for the Lua interpreter and how it is slower than a handwritten JIT, but not by that much as you would expect, and it is much more maintainable. And using this approach with this additional machinery that is needed for the just-time compiler that tries to compile during our build time, like the simple opcodes that are later glued together to this JIT,
optimize machine code and so on and to discover whether that trace that we're running is still correct or maybe we need to throw it away because we thought this thing that we're running is like adding two integers, right? But now we're seeing, oh, there's a float that we did not expect. So we need to throw out this optimized code and actually go back to the interpreter again
optimize machine code and so on and to discover whether that trace that we're running is still correct or maybe we need to throw it away because we thought this thing that we're running is like adding two integers, right? But now we're seeing, oh, there's a float that we did not expect. So we need to throw out this optimized code and actually go back to the interpreter again
So all this infrastructure is already in 3.13. And so far, we can proudly say that with all this added, Python is not slower. 0% faster. Yes, it is 0% faster because, again, with the release cadence that we're having, 12 months of work. is a lot, right, obviously, but it is not enough to like just say we started from zero JIT and ended up with a mature JIT like V8, we are done.
So all this infrastructure is already in 3.13. And so far, we can proudly say that with all this added, Python is not slower. 0% faster. Yes, it is 0% faster because, again, with the release cadence that we're having, 12 months of work. is a lot, right, obviously, but it is not enough to like just say we started from zero JIT and ended up with a mature JIT like V8, we are done.