I'm curious about the performance differences between Python 3.13 and 3.11 when running in single-threaded mode with the GIL enabled. I've read some mixed opinions about Python 3.12 before deciding against upgrading from 3.11, but now that we have Python 3.13.3 out, I'm wondering if it offers significant improvements. I've only come across performance tests focusing on the experimental free-threaded mode, which seems to be slower than 3.11. So, what are your thoughts? Is Python 3.13 really any faster than 3.11, particularly with the JIT compiler?
5 Answers
I've been working on my game using Python/Pygame for a while, and I noticed a clear improvement jumping from 3.12 to 3.13, even without proper benchmarks! My FPS went up by about 5 or 6 frames, which is massive for game performance. I'd recommend upgrading if you can and trying some benchmarks like the `time` module or `scalene` for profiling.
Profiling your code could definitely give you the best insight into performance! Using tools like `pyenv` can really help manage different versions and environments for benchmarking.
There are lots of different ways to measure performance! If you have specific workloads in mind, the best bet is to run your own benchmarks. Typically, CPython includes performance improvements in each release, though not all benchmarks may show these enhancements equally. Python 3.11 saw a reported average performance uplift of about 25%. Expect Python 3.13 to be a bit faster overall, but keep in mind that its focus has been on setting the stage for future improvements, especially with the JIT compiler and free-threaded mode. If you're really performance-conscious, compiling Python yourself might yield better results for your setup!
Yeah, benchmarking sounds like the way to go. Everyone keeps suggesting it, and I guess that's where the real data will come from!
I’ve noticed a slight improvement in performance from Python 3.10 to 3.13 in my ML/AI projects. That said, the coding style is much more critical for performance. Focusing on vectorized operations instead of traditional loops makes a huge difference. Switching to polars from pandas also provided a whopping 40x speedup for me!
Performance chat about Python? Seems a bit of a contradiction unless you consider how much Python can indeed be optimized! But hey, if it works for you, that's what counts.
That link to the 16 years of Python performance is exactly what I needed! I'm not obsessed with squeezing out every ounce of performance, but I'll definitely keep major upgrades like this on my radar for the future.