[英]PyGTK: upon profiling, gtk.main() takes more time than expected, how do I know if this is reasonable?
我的程序是一個不斷更新顯示的可視化工具。 我正在嘗試對其進行優化以提高幀率,而我最大的成本是 gtk._gtk.main:
ncalls tottime percall cumtime percall filename:lineno(function)
1 9.159 9.159 45.476 45.476 {gtk._gtk.main}
868 8.146 0.009 9.884 0.011 xyz.py:291(gfx_transform_queue)
868 7.705 0.009 12.657 0.015 xyz.py:322(gfx_draw_queue)
868 3.886 0.004 7.755 0.009 xyz.py:240(gfx_queue_atoms)
868000 2.638 0.000 4.952 0.000 xyz.py:365(gfx_draw_circle)
7027010 2.111 0.000 2.111 0.000 xyz.py:314(cmp_queue)
1736000 2.015 0.000 2.015 0.000 {method 'draw_arc' of 'gtk.gdk.Drawable' objects}
869844 1.728 0.000 1.728 0.000 {numpy.core._dotblas.dot}
868 1.635 0.002 3.746 0.004 {sorted}
869872 1.261 0.000 1.261 0.000 {numpy.core.multiarray.array}
933 1.100 0.001 1.100 0.001 {method 'get_pointer' of 'gtk.gdk.Window' objects}
這是合理的行為,還是我做錯了什么讓 gtk.main 花費了很多時間?
您對分析數據的解釋是錯誤的。 gtk.main() 實際上只是在用戶與之交互時運行您的程序。 您所看到的是運行程序需要時間,而不是 gtk.main() 本身。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.