SnakeViz 0.1 – A Python Profile Viewer

When profiling code it can be helpful to have a visualization of the profile to really show what areas of your program are taking the most time. The great RunSnakeRun application has been filling this roll for a while now but some of my colleagues have been turned off by the need to install wxPython. The web browsers we use every day are quickly becoming great visualization platforms so I thought it would be a nice project to make a Python profile viewer that works in the browser. Today, co-developer Erik and I are happy to announce the first official release of SnakeViz.

An example SnakeViz visualization.

Foundation

SnakeViz uses the Tornado web application framework and server, along with the Jinja2 templating engine. Both Tornado and Jinja2 are simple, easy to install Python packages, making the installation of SnakeViz very straightforward. The visualization is powered by D3.js and the profile stats table by Google’s JavaScript visualization API. They layout and styling of both the SnakeViz app and homepage are made easier with the use of the Bootstrap front-end framework.

Current Limitations

SnakeViz is currently unable to handle large profiles due to the difficulty of representing a large call tree as a JSON string, and the slow down most browsers experience when rendering an SVG with thousands of individual paths. For now, we think SnakeViz can handle call trees with less than a few thousand nodes. SnakeViz will fail gracefully if it is unable to process a profile and the table of statistics will still be complete and operational, so it’s not totally useless even when it cannot produce the visualization.

The Future

We have some ideas to improve the performance of SnakeViz in future releases and hope to someday make it equally useful for all profiles. We also plan to put an operational version of SnakeViz up on the web where you’ll be able to upload and store profiles, as well as send links to your colleagues so you can show the results of your hard work optimizing code. At some point we’d also like to add some different visualization types.

Learn More

Check out the SnakeViz homepage for a full run down and installation instructions (it’s easy, we’re on PyPI). You can browse the code or even fork the project on GitHub. We appreciate feedback on how well SnakeViz works for you! Please leave comments here, submit issues on GitHub, or get in touch via socialmedia.