Effective PyCharm (2021 edition) Transcripts
Chapter: Performance and profiling
Lecture: Our intuition often fails us for performance
0:00 As we get into this profiling topic,
0:02 I want to really drive homeless idea that guessing and using your intuition for what part
0:07 of your program is slow and what part is fast?
0:10 It often fails us. In more than one time in my career.
0:14 I've been working on some code and some program and it's really slow and like,
0:19 wow, this is the little section I need to focus on because I'm sure this
0:23 looks complicated. Seems like it's doing a lot.
0:25 This must be the problem. And it turns out that was only 5% of the
0:30 time. There was some other section I didn't even come aware of that was 95%
0:34 of the time. And if I could have completely erased all the time spent on
0:38 where I thought it was slow,
0:39 it would have only made it 5% faster.
0:41 It still would have been basically slow.
0:44 So what we're going to learn in this chapter is how do we measure?
0:47 We measure what our program is doing and where is spending its time.
0:51 And then we can go with that more accurate information,
0:55 dive in and start using our programming experience to make that bit of code faster.
1:00 So before you just dive in and try to make something fast and optimize it and make it potentially complicated, remember measure and then work on it.