26 ms·
I love the idea of fast Python profilers that don't require modified source code to run. One profiler I used recently which isn't mentioned in the readme is py
by JackC 7y ago
I love the idea of fast Python profilers that don't require modified source code to run.
One profiler I used recently which isn't mentioned in the readme is pyflame (developed at uber):
https://pyflame.readthedocs.io/ https://pyflame.readthedocs.io/
pyflame likewise claims to run on unmodified source code and be fast enough to run in production, so it might be worth adding to the comparison. It generates flamegraphs, which greatly sped up debugging the other day when I needed to figure out why something was slow somewhere in a Django request-response callstack.
- albertzeyer 7y agoSimilar to PyFlame is also py-spy: https://github.com/benfred/py-spy https://github.com/benfred/py-spy > While pyflame is a great project, it doesn't support Python 3.7 yet and doesn't work on OSX, Windows or FreeBSD. I wonder how the CPU profiling in Scalene is different. It does not mention PyFlame or py-spy at all in the Readme. Of course, the memory profiler is some nice extra.
- emeryberger 7y agoScalene author here. I was not aware of either tool - many thanks for the pointers! I just tried py-spy (I will try PyFlame on a Linux box momentarily). It's pretty cool, though having to run it as root on OS X isn't great (scalene runs without the need for root privileges; the CPU profiling part is pure Python). Py-spy does appear to efficiently track CPU perf at the line granularity (and does a lot of other stuff). It does a lot of things that scalene does not do, but not memory profiling. Also, I personally prefer scalene's line-level display of annotated source code vs. the flame graphs, but YMMV.
- Znafon 7y agoThe possibility to run py-spy on an already running Python program in production is pretty awesome. Do you think Scalene could do this?
- mlthoughts2018 7y agoYou can fairly easily write helper scripts using eg pkg_util to automatically add profiler decorators (eg with kernprof) so that profiling never requires modifying code. My team has a large body of profiling code written with kernprof and none of it modifies the underlying source. Profiler annotations are solely added automatically by the little profiler runner tooling we wrote. Not to say other profiling tools aren’t worth it.
- monkeyshelli 7y agoSadly it seem that pyflame is not maintained anymore: Pyflame: A Ptracing Profiler For Python. This project is deprecated and not maintained per https://github.com/uber-archive/pyflame https://github.com/uber-archive/pyflame