jandy-team / jandy

A historical performance trace tool/service
http://jandy.org
GNU General Public License v3.0
12 stars 13 forks source link

Jandy-python profiler is slower than other profilers #44

Open MyeongKim opened 8 years ago

MyeongKim commented 8 years ago

Today I tested the performance of Jandy-python profiler with my sample Django project. Profiling time was measured which starts and ends with running profiler. The result time(second) is as below.

-- jandy-python cProfile pyinstrument vmprof plop
python2 34.050 1.038 0.887 0.685 0.752
python3 11.682 1.030 1.157 0.955 0.901

Jandy-python profiler spent a lot more time than others. And I could figure out that compiled code execution time was almost same with the profiler exit time.

Until now I think "settrace" function inside profiling code makes some problems. I found some info about this function. http://stackoverflow.com/questions/1692866/what-cool-hacks-can-be-done-using-sys-settrace/1693108#1693108

And it looks like other profilers don't use "settrace" function.(at least as a default option.) Python "signal" is used instead and it has lower overhead.

But "signal" doesn't support inter-thread communication. So we need other approach if we use this. yappi <- This profiler supports multithread profiling. Below is the Github page of other profilers that I used this time.