In this lesson, we will look at some simple ways for improving the performance of Python programs. As you work through the episodes, you will get the opportunity to try out each of the techniques and observe the results. The idea is not to get through the work as quickly as possible, but rather to understand the reasoning behind the improvements so you can apply them to other Python programs.
The examples in this lesson can be run directly using the Python interpreter, using IPython interactively, or using Jupyter notebooks.
|00:00||Introduction||Why is Python slower than compiled languages like C and C++?|
|00:05||Timing Python Code||How can I tell how long my python code takes to run?|
|00:15||Built-in Functions||How can I speed up my function?|
|00:35||Function Call Overhead||Do functions affect my program’s performance?|
|00:45||Membership Testing||What is the best datatype to use when searching for elements?|
|00:55||String Concatenation||How is it possible to improve the performance of strings in Python?|
|01:05||Decorator Caching||How can I use a decorator to improve the performance of a function?|
|01:15||Optimizing Loops||What are the main factors affecting the speed of Python loops?|
|01:30||Import Overhead||What impact does the import statement have on program performance?|
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.