Kodi Community Forum
Speed question? xml vs. python - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Speed question? xml vs. python (/showthread.php?tid=316692)



Speed question? xml vs. python - KM5TZ - 2017-06-17

I have an addon that runs a timing sensitive routine. I have 2 screens coded in xml. These screens share several common features such as progress bars.

Right now I have about 30 text fields that I reconfigure when switching from one screen configuration to the other. I do this with 30 lines of xbmcgui.window(10000).setProperty('field','value') statements in my Python code.

My question is would my code execute faster if I hard coded the different text fields in my xml code and simply toggled the visibility field of each set from my python code? Then I'd only need one or 2 lines of Python code to select between the 2 screen configurations but my xml code would be 2 x longer.

Please let me know if you think this would be better posted in the skinning section (I'm a newbee).


RE: Speed question? xml vs. python - Lunatixz - 2017-06-17

Without code to review I can't give you specifics... In general setProperty is NOT as efficient as a static xml value... I recommend you use the below to monitor execution time.

https://docs.python.org/2/library/timeit.html