It has been over two years since Erik Bray and I made the first release of SnakeViz 0.1, a tool for visualizing performance profiles of Python code. It had multiple performance bottlenecks, but it worked just well enough that it took me a long time to prioritize making improvements. That time has finally come around and I’m happy to announce that SnakeViz 0.2 is now available!
The look and feel of SnakeViz remains much the same (see a screenshot), but there are some new things on the screen:
- Detailed function information when hovering over the visualization
- Call stack list for tracking where you are when zooming the visualization
- Control the depth of the displayed call tree
- Limit the display of functions that take up relatively little time
Under the Hood
The first release of SnakeViz had some performance bottlenecks:
- It tried to transfer a complete call tree from the server to the client as JSON
- It tried to display the entire call tree in the sunburst visualization
Those limited the usefulness of SnakeViz with profiles that contained calls to a lot of functions. The version 0.2 release is an almost complete rewrite in order to make SnakeViz work with larger profiles.
The first limitation is addressed by moving the building of call trees into the client application. Profile data is passed from the server to the client in close to the same form as it’s available from Python’s pstats module. Once in the client, the profile data is used to construct call trees on demand for visualization.
The second limitation is addressed by limiting how much of the profile is visualized at once. Call trees are built only to a user specified depth and users can opt to omit functions that do not use much time from display. (The “depth” and “cutoff” controls.)
I and others have tested SnakeViz 0.2 with some fairly large profiles and found it works. You can read more about SnakeViz in the updated docs. Please give it a try! Issues can be reported on GitHub.
5 thoughts on “Snakeviz 0.2”
sorry if I missed it in the docs, but what are the requirements besides > python2.6? I’m interested in using it with my own bottle web server.
The one dependency is Tornado, which is used to render/deliver the HTML page template and serve the static assets.
thanks, I’ll see if I can figure out how to factor that out so the server is pluggable.
The server actually does very little. The prepping of the stats data is all done in the snakeviz.stats module. The viz.html template does depend on Tornado’s template language. But if you can put the html rendering in its own utility and have your server send the snakeviz static assets I think it could work.
Thanks, I will fork the repo and if I have some success, I’ll get back to you with a pull-request. thanks for the hints!