Measuring and Profiling Performance in Python Code
This unit introduces the core method behind performance optimization: profiling. By measuring the amount of time it takes code to run, both in microbenchmarks (i.e. single functions) or across whole scripts, clarifying what “performance” means in scientific computing reveals why intuition often fails, and how we can make strong decisions about how to improve our code. +
Sessions
Measuring and Interpreting Time in Python
This notebook focuses on building an intuition for careful time measurement rather than blindly trusting a single timing result.
Micro-Benchmarking: Measuring How Code Scales
This notebook focuses on measuring and visualizing how performance changes as data grows, helping us gain a stronger understaanding of our code.
Profiling Code: What lines, and what functions are taking the most time?
This notebook introduces a disciplined workflow for improving runtime without breaking correctness: first lock in behavior, then measure where time is actually spent, and only then optimize.