3 ms·
I really like the simplicity of your solution, but you might be interested in kernprof: https://github.com/rkern/line_profiler https://github.com/rkern/line_pro
by tgb 9y ago
I really like the simplicity of your solution, but you might be interested in kernprof: https://github.com/rkern/line_profiler https://github.com/rkern/line_profiler It seems to be the nearly-canonical line-by-line profiler for Python, or was some years ago.
- mherrmann 9y agoInteresting, but much more complex. I suppose it's more powerful as well as a reward. I've never had the need for such complexity though.
- tempay 9y agoIts implimentation is much more complex but I'd recommend trying it as it's trivial to use in practice: - Find a suspiciously slow function using cProfile - pip install line_profiler - Edit function to start with @profile - Run kernprof - Take a look at the output and act accordigly