Python profiling tools

Sat 08 June 2013

This is a small addition to the previous article about the debuggers.

The stdlib has 3 backends (cProfile and profile , hotshot) and countless 3rd party visualization tools, converters and whatnot. Where there are many tools there's plenty of bad advice ...

If you don't know what are you looking for, just use a visualization tool! *

There's so much advice to just roll out your own visualization tool, be it text using the Stats from stdlib or graphical using libraries like pycallgraph or gprof2dot the first reaction would be to actually start writing code to generate reports.

But this is a bad idea, you need to change that code to skew or drill down in the report and generally everything will be confusing if you're not looking for something specific. You will probably overlook that thing that is killing your performance.

RunSnakeRun *

You can install it with pip install RunSnakeRun or apt-get install runsnakerun or from sources.

RunSnakeRun is a well rounded tool, easy to integrate - you can just use it with the stdlib cProfile/profile, just specify the filename argument to profile.run, eg:

import cProfile
cProfile.run("main()", filename="my.profile")

After that, run this in the shell:

runsnake my.profile

::...

免责声明:
当前网页内容, 由 大妈 ZoomQuiet 使用工具: ScrapBook :: Firefox Extension 人工从互联网中收集并分享;
内容版权归原作者所有;
本人对内容的有效性/合法性不承担任何强制性责任.
若有不妥, 欢迎评注提醒:

或是邮件反馈可也:
askdama[AT]googlegroups.com


订阅 substack 体验古早写作:


点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

关注公众号, 持续获得相关各种嗯哼:
zoomquiet


自怼圈/年度番新

DU22.4
关于 ~ DebugUself with DAMA ;-)
粤ICP备18025058号-1
公安备案号: 44049002000656 ...::