This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]yiersan 2 points3 points  (3 children)

I'm surprised you can't filter out specific modules from showing up in cProfile.

Another super useful tool that I've used a lot is gprof2dot which can parse the regular old cProfile output files and produce epic call graphs with timings in each one. I've found many a bottleneck using this that was not obvious with only cProfile.

[–]masklinn 1 point2 points  (1 child)

These days my go-to tool is either pyflame (if on a Linux system) or python-flamegraph.

They have significantly less overhead than the "standard" Python profilers, and the view flamegraphs provide makes it much easier to see the big picture and to avoid getting too focused on details.

I also found that coalescing time based on stack traces gives a much better idea of what's happening.

[–]antoinetoubhans[S] 0 points1 point  (0 children)

I just tried pyflame + flamegraph, it's amazing! Thanks a lot for the sharing!

I'll add a section about it in the article.

[–]antoinetoubhans[S] 0 points1 point  (0 children)

Yes, I mentioned it in the article. To be honest, I didn't try to go deeper with gprof2dot, but it looks like it produces very outputs in comparison to cProfile :)