Python Performance Tuning

Python interpreter implementationsm, such as CPython, attempt to optimize the performance of the running program. However the nature of the Python language can make this a challenging task. Dynamic types and other Python features prevent the language from being statically optimized, so there are many tasks that can only be performed when the program runs. In addition, Python data types can be inefficient if used incorrectly, so it is important to ensure that the right data structure is used for the job.

In this lesson, we will look at how to diagnose and solve performance related issues in Python programs.

Prerequisites

The examples in this lesson can be run directly using the Python interpreter, using IPython interactively, or using Jupyter notebooks.

Schedule

00:00 Introduction to Profilng What does it mean to profile a program?
What are the different types of profiling techniques?
How can profiling information be used?
00:10 cProfile What is the cProfile module and what is it used for?
What type of information does cProfile provide?
00:50 line_profiler What information does line_profiler provide?
How is line_profiler different from cProfile?
01:30 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.