Started work on getting py-spy/speedscope in RunSnakeRun

So having finally written down the thoughts on a carbon tax, that kept distracting me from actually working on Open Source, I finally got a bit of work done on Open Source on the last night of the vacation.

What I started work on was getting a sampling profiler format supported, and for that I chose py-spy, particularly its speedscope export format. The work is still early days, but it does seem to work in my initial test cases.

At the moment I'm only supporting the "sampled" mode (vs the evented mode, which is closer to coldshot) for the format. I haven't implemented module/location tree-view yet. More annoying, the sample format doesn't include start-of-function information, so there's no differentiation between two functions with the same name in the same file for separating out the results. The results are also a bit confusing when you're used to cProfile style, as the boxes are stack-line based, so you'll see separate boxes for funcname:32 and funcname:34 children next to each other even though its the same child function involved. That's confusing enough that I'll likely group children that are calls to the same function (regardless of which line in the function they were in during the sample) into the same box.

The speedscope format would also make it pretty easy to do per-line heat-maps in the file, and obviously (given it's what speedscope normally does), a flame-graph would be a reasonable display as well. Anyway, when I have some more vacation time I can look into further work on it.


Comments are closed.


Pingbacks are closed.