Profiling #143
Replies: 12 comments
-
One avenue we could try is dtrace. IIRC it's supported on Linix and macOS and there's already some code to deal with it. On Windows I've been recommended ETW (Event Tracing for Windows). |
Beta Was this translation helpful? Give feedback.
-
Per https://stackoverflow.com/q/4141307:
|
Beta Was this translation helpful? Give feedback.
-
https://instagram-engineering.com/profiling-cpython-at-instagram-89d4cbeeb898 |
Beta Was this translation helpful? Give feedback.
-
There are two types of information that are important; timings and event counts. Timings are best got from a statistical/sampling profiler. VM events counts (like allocation counts, bytecode instructions executed, etc.) are not modified by instrumentation, |
Beta Was this translation helpful? Give feedback.
-
By "GP formats" do you mean gprof? Also, what would we use for instrumentation? I'm guessing there's a library that would keep things simple (and efficient) for us.
👍 |
Beta Was this translation helpful? Give feedback.
-
IIUC mostly we just have to keep track of our own counters. The interesting stuff is dumping those counters in some format to disk, at a convenient location, and tools to browse the counters. For Windows, ETW should be able to do this (it dumps via the OS kernel, not sure where the events end up being logged physically, but you can extract them to a file later). But we could also write our own Python script that extracts an array of counters and dumps them in a file indicated via an environment variable, sort of like we do for dxpairs. |
Beta Was this translation helpful? Give feedback.
-
Curious whether Austin might be useful here. It's billed as a sampling profiler for Python programs, but it's pure C code. |
Beta Was this translation helpful? Give feedback.
-
Also, @gramster mentioned bprof to me and indicated that @jakebailey may have some good insight on it. |
Beta Was this translation helpful? Give feedback.
-
May have misheard; I use https://github.com/google/pprof (mainly for Go and Node), which does have a C/C++ library I haven't tried out (but is used for profiling chromium, for example). |
Beta Was this translation helpful? Give feedback.
-
Ah, I definitely misheard. 😄 |
Beta Was this translation helpful? Give feedback.
-
The Coz causal profiler looks interesting. According to the related paper, the authors used it to great effect in identifying a performance bottleneck in sqlite. Related StrangeLoop Conference talk Youtube Video You build with |
Beta Was this translation helpful? Give feedback.
-
@brandtbucher tried coz last week and reported that it flagged lines for which we couldn't understand what would be wrong with them. We concluded that it's probably not useful for us (the example from the talk certainly sounds like it's more helpful for multi-threaded apps). If you're interested in proving us wrong, please give it a try and report back here! |
Beta Was this translation helpful? Give feedback.
-
Ideally our optimization work will be guided by profiling data. There are a number of factors to sort out in this area:
Beta Was this translation helpful? Give feedback.
All reactions