Python is About to Become 64% Faster - Python 3.10 vs. Python 3.11 Benchmark | Better Data Science

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys and welcome to better data science it's no secret that python isn't the fastest programming language out there well that's about to change or at least head in the right direction the newest python release or python 3.11 is expected to be released in october 2022 what's even better is that there's a release candidate or rc version available for us to play around with that's exactly what we'll do today we'll install python 3.10 and python 3.11 in separate document containers and see how they compare in a suit of benchmark tests and why we'll do it well there's been a lot of hype going on lately about python 3.11 in a nutshell people are saying that it's significantly faster than the previous releases so i wanted to test it out if you want the short version well here it is on average python 3.11 is 14 faster than python 3.10 the new version is marginally slower on some benchmarks but on the others it's up to 64 percent faster i ran the benchmark saw an m1 pro macbook pro 16 inch with 10 core cpu each python version was installed in docker which utilized biological cpu cores your mileage may vary but relatively speaking you should see similar results and now let's go for the long version the first step is to install both python 3.10 and 3.11 in separate docker containers if you want to follow along you'll need docker installed it's a must-have tool in any data science tool well so it shouldn't be an issue once docker is running open two terminal tabs just like i have here in the first tab we'll fetch and run python 3.10 in the background the command is docker run the the python 3.10 at 4 bullseye and in the second tab we'll do the same thing but for python 3.11 doc run the the python 3.11 slash or minus rc minus bullseye i already have the images downloaded so docker just runs them for me for you docker will take some time to download and start both images depending on your card configuration and internet speed once you have them both running what you should do is to open visual studio code and attach both containers in separate windows as you can see i have python 3.10 on the left side of the screen and python 3.11 container on the right side now i'll launch the integrated vs code terminals in both and for here that's all while we're here let's also check python versions so python here is python 3.10 and here it's python 3.11 up next we'll install the pi performance package and run the benchmarks okay so we have both containers running and attached in vs code that was the hard part the next step is to install the pi performance package we'll need to do that in both so let me clear and python 3 dash pip install pi performance let's do the same here by the tree dash and pip install by performance this shell and when this installs i'll also clear it and now we can actually run the benchmarks for python 3.10 i'll save the output to python json file so by performance run go for output byte310.json and here we'll do the similar by performance run to pi 311.json these commands will run a suit of couple dozen benchmarks so yeah it will take some time i'll get back to you once they're done okay so the tests have finished and now we have the json file saved in containers as you can see the one is here so i'll download it save its desktop to this folder and i'll do the same for python 3.11 download and now let's finally compare the performance i can now minimize vs code and go back to the terminal close one tab because we need only one and i'll activate the basic on the environment and install the pi performance package by performance i already have it installed and i'll go to the desktop to this folder as you can see i have both by 310 and by 311 json files and to compare them we can run pi perf compare 2 by 310 and that json2pi311.json and we want to format the output as a table so here are the results i've counted five tests in which python 3.10 was marginally faster than python 3.11 in others python 3.11 was up to 64 faster than python 3.10 according to the geometric mean python 3.11 was 14 faster than python 3.10 and there you have it performance comparison between python 3.10 and python 3.11 it's worth noting that python 3.11 isn't out yet at least officially so we're comparing a fully stable release with a release candidate maybe the gap will be even bigger between the two after the official release only time will tell what do you think about the upcoming python release are you excited to see python running faster or you don't care at all let me know in the comment section below if you like this video and want to see more data science and data engineering content please consider giving it a thumbs up and subscribing to the channel thanks for watching i'll see you next time
Info
Channel: Better Data Science
Views: 14,252
Rating: undefined out of 5
Keywords: python, programming, data science, code, coding, machine learning
Id: 1aevauFG_-Q
Channel Id: undefined
Length: 7min 2sec (422 seconds)
Published: Thu Apr 28 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.