#100DaysOfCode in Python Transcripts
Chapter: Days 49-51: Measuring performance
Lecture: Intuition fail

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Now something that will probably catch you off guard at some point is that your intuition is actually really bad for guessing where program is slow
0:10 and where it spends its time. This has happened to me many, many times and I've been doing programming for a long while.
0:18 Sometimes you get it right, but often you don't. So the first thing that you need to do before you try to improve the performance of your application,
0:25 is measure, measure, measure, and that's profiling. So what we're going to do is we're going to run a built in command that's built in to Python itself
0:34 to measure where our code is working. And we're going to do this in two particular ways. We're also going to have some nice output.
0:41 Now in the beginning the output that we're going to work with is actually going to be just sort of a text table type thing in the terminal
0:49 or just in the program output. And at the end, I'll show you actually how to get PyCharm to draw these little graphs
0:56 where it shows you we start up program and call main, main calls go, and then go is calling these 3 functions
1:02 and even the color tells you where you're spending the time. Like, the red is worse than the yellow which is worse than the green, and so on.
1:08 So we're going to be able to get this kind of output and understanding from our program.


Talk Python's Mastodon Michael Kennedy's Mastodon