Easily profiling python code line by line
$ pip install --pre line_profiler
Annotate the method(s) you want to profile (no need for imports):
@profile
def will_be_profiled():
...
$ kernprof.py -l script.py
By now, a script.py.lprof file has been generated. To visualize the times of each line:
$ python -m line_profiler script.py.lprof
Written by José Ricardo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#