Mastering 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,
0:05 if you try to understand its performance
0:07 visual tools here also are really, really important,
0:10 let's go and play with the visual tools for understanding performance in PyCharm.
0:15 Over here on github under 9-performance
0:18 we already have a little application here, performance app
0:22 so this is similar to the one you just saw in the demo, it's related to this chapter
0:27 so we're going to come down here
0:29 and we're going to use the tools to understand the app's existing performance
0:32 and then improve it in a few key areas
0:35 so we're going to go and open up this project,
0:39 now if you create a virtual environment or you just do it on your main system,
0:43 be aware you need Requests installed for it to work
0:45 because one of its features is it goes out and makes a call to a web service,
0:49 so notice here, we'll use the profile program
0:52 this only gets set up once you create a run configuration
0:55 so right click on programs, they run and then you can profile it.
0:58 So first thing we're going to do is answer a couple of questions,
1:02 what are the three slowest methods and why,
1:05 and then what is making them slow
1:08 and then you go through, there's a few to do's in the code
1:12 that says here's a section that could be improved, theoretically,
1:15 it's got a time.sleep type thing and say
1:18 well what if we use NumPy, maybe that makes it 20 times faster,
1:22 so make that number 20 times smaller
1:24 or what if we add an index, make it a 100 times smaller,
1:27 so you can follow a couple of these steps here,
1:29 keep running the performance tools to see what the changes and effects are
1:33 and we'll make this program faster.