Python 3.11: A Guided Tour Through Code Transcripts
Chapter: Python 3.11 Performance
Lecture: Python 3.11 is Delivering on Performance

Login or purchase this course to watch this video and the rest of the course contents.
0:00 I want to dive into this performance, signed a Python 3.11. There's a couple of cool places to look over here on this website,
0:08 there's a post with a whole bunch of benchmarks and graphs,
0:12 you know, pages and pages of them with different graphs showing Python 3.11 versus the three prior versions,
0:20 10, 9 and 8. And the title of this post is Python 3.11 performance benchmarks are looking fantastic
0:29 and oh yes. Oh yes, they are. What's notable here is this is actually published in june so this is just the beta version. This isn't even the final,
0:38 most polished, most optimized version of python. And here you can see 3.11 beta is almost 50% faster
0:46 than 3.9 and 3.8 and 40%. I'm just eyeballing it here faster than 3.10 on this particular benchmark we saw with the no cost or zero cost exceptions,
0:57 that part of python got maybe 20% faster. So really, really nice to see all these improvements if you want to dive in,
1:05 you can look here. The faster CPython team says sometimes there's no improvement. Sometimes there's 10%. Sometimes there's a 2x improvement,
1:15 you know, 100% better. So your mileage will vary depending on what you're doing. But this is really great. There are many people who suggested.
1:25 Well pythons too slow, you've got to go to some faster language that's less true now. Also, I don't think it's that true in the first place for many,
1:34 many use cases. But if it was true, it's a little bit less true now, this is, this is fantastic. Let's take another example here.
1:43 If you look at PyPI.org, that's the python package index. They keep very detailed analytics of the CPU usage of their web app,
1:54 Their G unicorn service powering many, many requests on PyPI.org.
2:02 It's kind of unimaginable. How much traffic, how many terabytes of traffic this website does but check this out
2:10 this is from when they switch from running on 3.10 to 3.11. You can see it's running around again. I've also at 0.7% or so,
2:22 of usage before and then it drops down to half 0.35, something like that. It's not entirely obvious here. If you zoom out.
2:33 Well, look at this graph here. Okay. The graph on the left before the big spike is 3.10
2:39 The graph to the right when it's all smooth as steady state warmed up.
2:44 3.11. That weird crazy spike in the middle is where they had to shut down everything flush out all the caches and the system had to build back up.
2:53 Things like it's cache and whatnot. So there was a little bit of spike as the system was restarted.
2:59 Had to warm everything up again. But once it got going, look at this really, really a massive difference. I mean that's,
3:07 you could probably have half as many servers. That is no joke. And that's just going from 3.10 to 3.11.
3:13 not like from 3.6 to 3.11. Right. This is a very, very small jump inversions and yet a huge jump in performance.
3:22 So Python 3.11 is definitely delivering for PyPI.org.


Talk Python's Mastodon Michael Kennedy's Mastodon