Python Profiling in Practice
Find repeated work, measure a change and check the result.
A focused 5-page practical workbook by Thomas Reid, with a runnable Python project, setup instructions, exercises and worked answers.
You will compare a repeated customer lookup with a dictionary index, read cProfile statistics, inspect saved profiles with SnakeViz and verify that both implementations return the same results. The example uses bounded sample data; speedups depend on your workload and machine.
Download: one ZIP containing the PDF, Python source, requirements and README. Tested on Windows with Python 3.13.17. SnakeViz is optional for viewing profiles.
This is a revised practical edition based on my published Medium article, with replacement runnable examples. It is not a verbatim reprint. Suitable for readers who can run a Python script.