It's usually not nice to dig out old threads, but neither is starting a new one with the same topic!
I found a 'not so nice' way to make a video plugin way faster on the RaspberryPi:
where it took 2-3s for every operation before, it is now done in 0.1s
I'll try to explain:
As discussed the problem is the slow python interpreter, it takes 2-3s to load the code and all the imports, the 'real' functionality is done in a few ms.
But what if the plugin was started only once?
I made just that:
- the plugin called by xbmc is just an interface to the real code, it is just a few lines and loads very fast
- on first run the plugin creates a thread of 'the real code' which keeps running
- on succeeding runs the plugin passes the arguments to the already running thread which in turn races through the functions
It works beautifully!
I made a wrapper for the original plugin that handles the communication but
I didn't change anything on the original plugin at all
There is still one problem I found a workaround but no real solution, I made a post about it:
Python: save reference to a thread
what is the prefered way of sharing code here?
It's just a few lines