Effective PyCharm Transcripts
Chapter: Performance and profiling
Lecture: Your turn: Profiling

Login or purchase this course to watch this video and the rest of the course contents.
0:02 Just like visual debugging is important for understanding how your code works, if you try to understand its performance
0:08 visual tools here also are really, really important, let's go and play with the visual tools for understanding performance in PyCharm.
0:16 Over here on github under 9-performance we already have a little application here, performance app
0:23 so this is similar to the one you just saw in the demo, it's related to this chapter so we're going to come down here
0:30 and we're going to use the tools to understand the app's existing performance and then improve it in a few key areas
0:36 so we're going to go and open up this project, now if you create a virtual environment or you just do it on your main system,
0:44 be aware you need Requests installed for it to work because one of its features is it goes out and makes a call to a web service,
0:50 so notice here, we'll use the profile program this only gets set up once you create a run configuration
0:56 so right click on programs, they run and then you can profile it. So first thing we're going to do is answer a couple of questions,
1:03 what are the three slowest methods and why, and then what is making them slow and then you go through, there's a few to do's in the code
1:13 that says here's a section that could be improved, theoretically, it's got a time.sleep type thing and say
1:19 well what if we use NumPy, maybe that makes it 20 times faster, so make that number 20 times smaller
1:25 or what if we add an index, make it a 100 times smaller, so you can follow a couple of these steps here,
1:30 keep running the performance tools to see what the changes and effects are and we'll make this program faster.


Talk Python's Mastodon Michael Kennedy's Mastodon