Contribute Media
A thank you to everyone who makes this possible: Read More

Profiling: Find the Squeaky Wheel


Python sometimes gets a bad rap for being a slow language, but slow code can be written in any language. The first step towards accelerating code is identifying where it’s slow: a 100x speed up to something that takes 1% of the time pales in comparison to a 1.1x speed up of something that takes 50% of the time. The Python Standard Library provides a collection of packages to get started--profile, cProfile, and pstats--and the community well goes deeper with interactive visualizations, deterministic vs. statistical, line vs. call stack profilers. In this talk, we will demo how to instrument sample slow code using cProfile, then find the source of the problem using the interactive tool SnakeViz. Another demo will be shown using py-spy, a statistical profiler which can be attached to running processes, requiring no modification to existing code.


Improve this page