Episode: Line Level Profiling
Closed this issue · 0 comments
Robadob commented
Learning Objectives
- decorate Python code to prepare it for
line_profiler
- execute a Python program via
line_profiler
to collect profiling information about a Python program’s execution - interpret output from
line_profiler
, to identify the lines where time is being spent during a program’s execution
Exercises
A couple of examples where line profiling is appropriate:
- e.g. decorating a specific function
- e.g. one where there are no functions, so how to decorate
Keypoints
These will need updating when the content has been written.
- Specific functions can be line level profiled with
line_profiler
if decorated with@profile
- Code in global scope must wrapped if it is to be profiled with
line_profiler
- The output from
line_profiler
lists the time spent per targeted line of code in descending order.