Integrate Line Profiling with Python Decorator(medium.com)
medium.com
Integrate Line Profiling with Python Decorator
https://medium.com/uncountable-engineering/pythons-line-profiler-32df2b07b290
4 comments
I don't have much experience with python profiling, but this looks like a really easy way to get granular performance metrics. I could see this being quite useful in longer functions with multiple performance sensitive parts. I'll make sure to keep this profiling technique in mind next time I have to write Python.
Line profiling like this is a lot easier for me to interpret than flame graphs, and the decorator seems convenient enough to just stick on any function. How does it work if you want to profile multiple functions within a stack?
Documentation typically recommends that python profilers be run as modules. Integrating them into the code directly as a 1-line import plus decorator makes it a lot easier to teach new developers to use the profilers.
Looks like a useful method.