Skip to content

Instantly share code, notes, and snippets.

@phaustin
Created April 12, 2019 20:23
Show Gist options
  • Save phaustin/c4d7a1215c932191b4fb9cea0586591e to your computer and use it in GitHub Desktop.
Save phaustin/c4d7a1215c932191b4fb9cea0586591e to your computer and use it in GitHub Desktop.
profiling trio

Nathaniel J. Smith @njsmith 19:36 whether you should expect profilers to be accurate in general is a complicated question :-) but many of them do work with trio

jtrakk @jtrakk 19:36 https://github.com/bdarnell/plop in particular

Nathaniel J. Smith @njsmith 19:37 I haven't tried that one but I'd say like, 90% likely it will work fine there are some weird issues around coroutines that can mess up stack sampling, but AFAIK trio has workarounds for them

jtrakk @jtrakk 19:38 it does does produce an output which looks reasonable, just wanted to check if there was something i needed .. yeah that

Nathaniel J. Smith @njsmith 19:40 stack-sampling collectors are generally the best strategy... don't use cProfile, it adds tons of non-uniform overhead, so your profiles may be telling you "these are the functions where cProfile added the most overhead" instead of "these are the functions that are actually slow" some other interesting options are py-spy and vmprof, though they both have polish issues still

jtrakk @jtrakk 19:41 yeah i wasnt able to get py-spy to work plop worked immediately with --format flamegraph and i plopped the output into https://www.speedscope.app/

Nathaniel J. Smith @njsmith 19:42 cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment