Slow Python scripts in Krypton

There is a nasty issue with Krypton that make Pythons script run super slow (50x). I described it here: Issues · xbmc/xbmc · GitHub

The fix could be simple by bumping the GUI sleep time to higher values. I don’t have a setup for compiling OSMC (I have one for Kodi running on Windows). What is the fastest way of verifying whether this fix works for OSMC?

For clarification. Here are some benchmarks on my rPi running OSMC with Krypton:

ncalls tottime  cumtime
1168   3.951    3.951  {method 'setArt' of 'xbmcgui.ListItem' objects}
584    0.655    0.655  {method 'setContentLookup' of 'xbmcgui.ListItem' objects}
584    0.227    0.227  {method 'setIconImage' of 'xbmcgui.ListItem' objects}
584    2.142    2.142  {method 'setInfo' of 'xbmcgui.ListItem' objects}
584    3.620    3.620  {method 'setLabel' of 'xbmcgui.ListItem' objects}
584    0.006    0.006  {method 'setLabel2' of 'xbmcgui.ListItem' objects}
584   14.035   14.035  {method 'addContextMenuItems' of 'xbmcgui.ListItem' objects}

Version this on Jarvis:

ncalls tottime  cumtime
1168   0.049    0.049  {method 'setArt' of 'xbmcgui.ListItem' objects}
584    0.009    0.009  {method 'setContentLookup' of 'xbmcgui.ListItem' objects}
584    0.005    0.005  {method 'setIconImage' of 'xbmcgui.ListItem' objects}
584    0.049    0.049  {method 'setInfo' of 'xbmcgui.ListItem' objects}
584    0.028    0.028  {method 'setLabel' of 'xbmcgui.ListItem' objects}
584    0.006    0.006  {method 'setLabel2' of 'xbmcgui.ListItem' objects}
584    0.210    0.210  {method 'addContextMenuItems' of 'xbmcgui.ListItem' objects}

Thanks! I assume this needs to run on the rpi?

You can run it on a Pi or a recent Debian / Ubuntu installation.

It is easier to iterate on the Pi itself.

thread moved to development and testing category

Yep, building at the moment, but is very slow on the rpi2

With a good SD card, your first build will take about 2 hours. Subsequent builds will leverage ccache, so you can do them in an about an hour.

I managed to get the first build to complete (2,5 hours). Now a second build seems to start all over, do I need to pass another parameter to the “make rbp2” statement to make it not start all over?

chroot, make your changes and re run make directly in the src folder. Then you can just copy kodi.bin

I tried that, but it tries to re-apply all the patches. Should I empty out the patch folder?

It won’t re-apply the patches if you run make in the src/xbmc* directory.

I tried but now get this:

sudo chroot  /opt/osmc-tc/armv7-toolchain-osmc
cd /mnt/package/mediacenter-osmc/src/xbmc-7781e47f997b2b100957c0eee2622df7346eb0e5
root@osmc:/mnt/package/mediacenter-osmc/src/xbmc-7781e47f997b2b100957c0eee2622df7346eb0e5# make rbp2
make: *** No rule to make target 'rbp2'.  Stop.

You should just run make

Thanks, worked out fine. Recompiling took about 30 mins or less. The fix I was testing also seems to improve a lot. It is located in this commit: Application: Allow python door to open for up to 80ms · popcornmix/xbmc@356e1a0 · GitHub

It’s not official, but it solves the slow Python runs.

When chrooted pass -j4 as OSMC build system is not in direct control.
This will speed up build time

I’ll talk to @popcornmix about when it’s appropriate to add any improvements

Same problem here. I’m using pelisalacarta addon (it’s for latin/spanish media content) and the loading of lists takes toooo long. I hope the PR with the patch is accepted…

I’m waiting this patch to be applied.

I noticed that some addons are very slow after update, and I see this and is exactly my problem.

I hope this will be in frebruary patch.

It will be included in our March update.
The February update has already been released

The official PR’s for Kodi have already been accepted and merged into both the 17.1 and 18.0 branches.

Yes – and we will backport them to 17.x as the 17.1 release seems to be a bit far off yet.

Sam