Speed question? xml vs. python

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
KM5TZ Offline
Junior Member
Posts: 12
Joined: Jan 2017
Reputation: 0
Post: #1
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).
(This post was last modified: 2017-06-17 00:39 by KM5TZ.)
find quote
Lunatixz Offline
Skilled Python Coder
Posts: 4,893
Joined: May 2011
Reputation: 142
Location: NYC
Post: #2
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
find quote