Checking your account

You can read the lesson while its saved answers and constructions load. Learning controls will open once that work is ready.

Profiling and Optimization

Python Profilers and timeit

BOTIE

Source alone does not reliably reveal which operation dominates a complete run. Profilers record execution costs so expensive or repeated work can be investigated. Python's documentation distinguishes its original profile implementation from cProfile, a lower-overhead C implementation based on lsprof.

The documentation also separates profiling from benchmarking. A profiler instruments a program to locate costs; timeit supports focused timing experiments. The tools address different questions. Neither makes one workload or machine representative of every deployment.

Sources for this history