Sample Video Frame

Created by Zed A. Shaw Updated 2024-02-17 04:54:36

Exercise 18: Measuring Performance

In this exercise you're going to learn to use several tools to analyze the performance of the data structures and algorithms you've created. To keep this introduction focused and small we'll look at the performance of the algorithms from Exercise 16, and then in the video I'll analyze the performance of all the data structures we've done so far.

Performance analysis and tuning is one of my favorite activities in computer programming. I'm that guy who will sit with a ball of tangled yarn while I watch TV and just pick it apart until it's all nice and orderly. I love teasing apart complicated mysteries, and code performance is one of the best complicated mysteries. There's also nice, useful tools for analyzing the performance of code, which makes it much nicer than debugging by comparison.

When you're coding don't try to implement performance improvements unless they're obvious. I much prefer to keep the initial version of my code very simple and naive so that I can ensure it works correctly. Then once it's working well, but maybe slow, I break out my profiling tools and start to look for ways to make it faster without reducing the stability. This last part is key because many programmers feel it's alright to reduce the stability and safety of their code if that makes the code faster.

Previous Lesson Next Lesson

Register for Learn More Python the Hard Way

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.