sumerc / yappi

Yet Another Python Profiler, but this time multithreading, asyncio and gevent aware.
MIT License
1.48k stars 73 forks source link

Fix callgrind output compression #17

Open orivej opened 5 years ago

orivej commented 5 years ago

callgrind format allows to compress repeated strings into one. yappi was using the syntax for compression but did not compress much. This change makes yappi actually compress repeated strings.

kcachegrind merges functions with the same compressed ID into one (as if they were inlined) even if they were defined in different modules. Therefore this change assigns different IDs to different functions with the same name.

sumerc commented 5 years ago

Thanks. I will look into this in detail. BTW, I realized we do not have any callgrind format unit test check. Do we have any way of ensuring the callgrind output we generate is valid via simple command or library in unittests? Any idea on that?

orivej commented 5 years ago

We could assert that callgrind export of predefined stats exactly matches a reference export. To change callgrind export format one would have to update the reference text. You could either see that the change of the reference text is right, or open the old and the new reference in kcachegrind and evaluate the change.