-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
timings wrong #112
Comments
This is an important callout and such a frustrating limitation of the |
I don't know if this should be closed; it's certainly not fixed. The documentation update speaks of missing information, but really SnakeViz shows incorrect information without warning. (See the example above.) I think that's pretty bad since people are just taking it for granted. In my opinion, a documentation update doesn't cut it here; very few people will actually read it. One solution would be to remove the wrong entries from the visualization. |
But then you wouldn't be showing the entire call tree, right? |
Indeed. There is no way to know the entire call tree either, that's just one property of the Python profile files. |
FWIW, this false reporting just confused the heck out of me and caused me to spend some time trying to figure out why calls were being made that actually weren't. Oops! 🙄 Years ago I used to use runsnakerun for profiling, and I don't ever recall being bit by this, and I used it quite a lot. Was this just luck, or did runsnakerun do something trickier to infer nested timing? FWIW, slides 8-12 in the deck for this ancient talk show an example of how runsnakerun handled nesting: I'll give tuna a try, and may also spark up a python2 venv to see how runsnakerun would have handled the example above. |
FWIW, here is what runsnakerun (unfortunately python2 only) shows for the sample script in the first post of this issue: There is clearly a MUCH higher priority on where time is spent vs trying to display a call tree with imperfect information available (although the call tree is still available by hovering). It still has the the same fundamental limitations due to the available data in the profile output, but it seems less obvious. Perhaps this is why I never ran into issues with runsnakerun, since the primary thing I care about is reducing time spent when doing time optimizations, not the call tree. A squaremap visual would be an awesome addition to snakeviz!! |
I just ran into this issue. It's pretty major in my opinion, I'm being lied to about much of the information that I actually wanted to learn about in the first place. Tuna is great at solving the false timings, but it's just much less user friendly than snakeviz (no offense). I personally don't see why this is a closed issue, am I missing something? |
If you could detail what you mean at https://github.com/nschloe/tuna/issues, it'd be happy to take a look. |
@nschloe Sure! I just did, I hope you find it useful |
The profiler still lies about timings, this issue was closed in commit that just documented that core functionality is broken - see 302fbc7 ("jiffyclub closed this in 302fbc7 on Jun 22, 2019 ") instead of not displaying unknown timings |
What is the current best solution to find out the time distribution of a function with multiple calls? Using snakeviz I cannot figure out where are the other 6s coming from for I tried I tried looking into other branches of the call tree "hunting" for those 6s, but had no luck. Thank you for any help in advance! |
@EmilianoG-byte Python's profile just doesn't contain that information. snakeviz's info is incorrect. tuna shows you exactly what you get from the profile. |
@EmilianoG-byte You might be able to find what you're looking for by working with the pstats module directly in Python. With that you can directly inspect the source data used by snakeviz, including getting a complete list of what-called-what. Just note that the
The extra calls might be getting hidden in the snakeviz display by the depth cutoff or the size cutoff. |
Thank you for the prompt answer @jiffyclub and @nschloe! It seems like |
SnakeViz tries to display the full timed call tree, but the profile file doesn't have the data for it. This leads to bogus information in SnakeViz. Consider
SnakeViz gives
which is wrong:
c()
really takes 4 seconds when called viaroot -> a() -> c()
, andd()
takes 1 second when called viaroot -> a() -> d()
; SnakeViz shows both as 5 seconds. More timings are wrong in the above screenshot.To work around this sort of bugs, I created tuna which gives only the information that can be deduced from the profile:
The text was updated successfully, but these errors were encountered: