This library is interesting because it give a nice output in the form of dynamic html graphs.
One example is better than a thousand words, in Jupyter Notebook:
# call this typically on your first cell %load_ext snakeviz %snakeviz single_line_method_profiling() # or you may want to profile a whole block of code %%snakeviz dope_list = [1,2,3,4,5,6] for i in list: perform_complex_operation(i)
This will open the result embedded directly in the notebook. If you want to see it in your favorite navigator, use
%snakeviz --new-tab or even efficient
That’s it, this way you’ll receive the output shown in the two following pictures. First one is the graphical view (which is totally interactive when in html mode) and a result table, which is dynamic according to the graphical view.
Don’t take the time displayed as real elapsed time but more as a relative reference.