3 ms·
Very cool, py-spy[1] has been an invaluable tool in my development process since jvns blogged[2] about it. The power of being able to visualize where your code
by abuckenheimer 6y ago
Very cool, py-spy[1] has been an invaluable tool in my development process since jvns blogged[2] about it. The power of being able to visualize where your code is spending its time is so obvious and I'm glad people are building tools to make that easier.
As a quick compare and contrast between py-spy and pyinstrument it looks like py-spy has the advantage of being able to attach to an already running process which is super useful when your program is stuck and you don't know why. I haven't used pyinstrument yet but I do like the fact that it can do its flame graph in the console, sometimes I find saving down an svg file and opening up the browser a bit arduous. Excited to give it a try.
[1] https://github.com/benfred/py-spy https://github.com/benfred/py-spy
[2] https://jvns.ca/blog/2018/09/08/an-awesome-new-python-profiler--py-spy-/ https://jvns.ca/blog/2018/09/08/an-awesome-new-python-profil...
- galacticdessert 6y agopy-spy seems also very interesting, thanks for linking it. I always found cPython to be quite difficult to work with, and usually reverted to line_profiler or some sort of UI for cprof files. The main added benefits of pyInstrument to me is the high signal vs noise ratio, as it is evidently clear what is taking the most time while retaining the option to dive deeper. I am also curious to try out the on-demand profiling integration with Flask, seems like a cool thing to have running in the background for my side projects
- synparb 6y agoAnother relatively new addition to the python statistical sampler space is Austin[1], that has a lot of similar features to py-spy. I haven't made a direct comparison yet between the two. [1] https://github.com/P403n1x87/austin https://github.com/P403n1x87/austin
- baq 6y agopy-spy is absolutely invaluable for the attach-to-process feature. also, nothing beats the adrenaline rush of attaching to a prod process and leaving it in a paused state after collecting a profile (true story! SIGCONT is your friend).
- formerly_proven 6y agoI see a lot of tracing and sampling profilers for Python, but are there any profilers for manual instrumentation (goes by a bunch of names, frame profiling, performance telemetry, APM etc.)?
- gnufx 6y agoAs an example, https://github.com/score-p/scorep_binding_python#user-regions https://github.com/score-p/scorep_binding_python#user-region... is the support in the HPC system https://score-p.org https://score-p.org (though it focuses on parallel programs). http://apps.fz-juelich.de/scalasca/releases/cube/4.5/docs/guide/html/ http://apps.fz-juelich.de/scalasca/releases/cube/4.5/docs/gu... is the associated profile analysis tool.
- eliwe 6y agoYou can use https://github.com/4rtzel/tfg https://github.com/4rtzel/tfg for an interactive console flamegraph. It supports opening pyspy files.