#100DaysOfCode in Python Transcripts
Chapter: Days 49-51: Measuring performance
Lecture: Intuition fail
0:00 Now something that will probably
0:01 catch you off guard at some point
0:03 is that your intuition is actually really bad
0:07 for guessing where program is slow
0:09 and where it spends its time.
0:11 This has happened to me many, many times
0:13 and I've been doing programming for a long while.
0:17 Sometimes you get it right, but often you don't.
0:19 So the first thing that you need to do
0:21 before you try to improve
0:22 the performance of your application,
0:24 is measure, measure, measure, and that's profiling.
0:28 So what we're going to do is we're going to run
0:29 a built in command that's built in to Python itself
0:33 to measure where our code is working.
0:35 And we're going to do this in two particular ways.
0:38 We're also going to have some nice output.
0:40 Now in the beginning the output that we're going to work with
0:43 is actually going to be just sort of a
0:45 text table type thing in the terminal
0:48 or just in the program output.
0:50 And at the end, I'll show you actually how to get
0:52 PyCharm to draw these little graphs
0:55 where it shows you we start up program and call main,
0:58 main calls go, and then go is calling these 3 functions
1:01 and even the color tells you where you're spending the time.
1:03 Like, the red is worse than the yellow
1:05 which is worse than the green, and so on.
1:07 So we're going to be able to get this
1:08 kind of output and understanding from our program.