Hacker News new | ask | show | jobs
by fijal 1953 days ago
Hi Dmitry, Hi Ryan

I love the fact that this is out! I have been the original author of vmprof and I have been working on profilers for quite some time. I'm also one of the people who worked on PyPy. We never managed to launch a SaaS product out of it, but I'm super happy to answer questions about profiling, just in time compilers and all things like that! Hit me here or in private (email in profile)

1 comments

Hi Maciej,

vmprof is cool! For Python we currently use py-spy. The way it works is it reads certain areas of process's memory to figure out what the current stack is. It's a clever approach that I like because that means you can attach to any process very quickly without installing any additional packages or anything like that. The downside is that from the OS perspective reading another process's memory is often seen as a threat — so on macOS you have to use sudo, and on Linux sometimes you have to take extra steps to allow this kind of cooperation between processes — we already saw people with custom kernels having issues with it.

Going forward we'll definitely experiment with more profilers and over time add support for other ones as well.

I saw you joined our Slack, we'll be happy to chat about profilers at some point :)

Note that py-spy seems problematic in containers—it requires ptrace, which means you need a special capability, and that's a security risk so many environments won't even give people the option to enable it.

In addition to vmprof, pyinstrument is another alternative.