OpenELEC / OpenELEC.tv

OpenELEC - The living room PC for everyone
http://openelec.tv
1.61k stars 884 forks source link

OpenELEC Python slow performance #2483

Closed Black09 closed 11 years ago

Black09 commented 11 years ago

Hi,

I noticed this on some add-ons for several month now... while TV Show Next Aired opens instantly on my OS X development machine (XBMC 12.2, Core i7 2600k), it takes about 2 seconds on my OpenELEC machine (3.1.3, Core i3 3225). The same happened yesterday on an updated version of pieh's RSS-Client. While switching between channels was almost instantly on OS X, it took several seconds on OpenELEC.

I then did some tests to find the problem and so far I've narrowed it down to the listItem.setProperty('key', 'value') function. While creating a new listitem and setting a test property with a string with length of ~1000 the execution was about a thousand times slower on OpenELEC than on OS X. What I've noticed though is that it sometimes seems to be as fast as it should be while sometimes its really slow. You can see some results below where you can see that it constantly changes from being slow and fast (I measured multiple times in a loop).

time: 0:00:00.016583
time: 0:00:00.016560
time: 0:00:00.016562
time: 0:00:00.016542
time: 0:00:00.000017
time: 0:00:00.016483
time: 0:00:00.000018
time: 0:00:00.000025
time: 0:00:00.000018
time: 0:00:00.016486
time: 0:00:00.016572
time: 0:00:00.016575
time: 0:00:00.016573
time: 0:00:00.000021

In case you're asking: Speedstep is disabled, the cpu runs always on the same speed (3,3GHz). Also it seems to be only this operation so far but there might be more.

Maybe someone has a clue why this happens and can fix it, thanks in advance.

vpeter4 commented 11 years ago

Can you provide some small test so it can be compared on other machines?

Black09 commented 11 years ago

Install http://cl.ly/2D3Y1H3a3u1y and run from the programs section.

Some results from me:

OS X:
avg time: 0.000022s
total time: 0.228883s

OpenELEC 3.1.3:
avg time: 0.001990s
total time: 19.901708s
stefansaraev commented 11 years ago

EDIT: sry. ignore this comment.. :)

vpeter4 commented 11 years ago

My time was consistent every time:

average time: 0:00:00.000037
total time: 0:00:00.378

I think this means 0.3 sec for 10000 properties? Which is ok?

Black09 commented 11 years ago

Yes that's normal... did you test with OE 3.1.X? If so than there must be a problem with my configuration but I have no idea what that could be.

vpeter4 commented 11 years ago

ION x86_64 devel-20130719203949-r15107

What top shows when running this script?

stefansaraev commented 11 years ago

Generic.x86_64 OpenELEC git: f838ee9818997d762e5a3b7d5bc8e4a7ef863387

results: average: 0:00:00:000048 total: 0:00:00:487133 ~ 100 runs, same result.

Black09 commented 11 years ago

Alright thanks for the tests. I did a quick test with a fresh userdata folder it seems to be fixed now. I'll try to find the problem which caused this to be so slow.

Black09 commented 11 years ago

Could you please test what happens if you run the script from the home screen? Currently if I run it from programs with a fresh userdata folder, everything is fine but if I run it from the home screen, it lasts 30 seconds.. however if I go into programs after a few seconds, the script is immediately done. Very strange...

stefansaraev commented 11 years ago

@Black09 home screen you mean settings -> appearance -> skin (confluence) -> settings -> addons -> home page program submenu ? if so - same results as above

Black09 commented 11 years ago

Ok than I have to live with it for now (very annoying...) because I can't figure it out. I renamed the .xbmc folder and started completely fresh but the script lasts 20-30s from the home screen and is fast from the program section. With all my configured stuff it's slow all the time... it almost seems as the script runs with very very low priority.

Black09 commented 11 years ago

I think I've figured out the problem... it seems it has something to do with multi-core. If I enable both cores in the bios, the script runs 20-30s off the home screen and if I enable just one core, it's not as fast but acceptable.

All cores + HT enabled: Programs: 0,05-0,1s Home: 20-30s

Just 1 Core enabled, HT off (it must be off, otherwise -> slow): Programs: 0,1s Home: 0,5s

I then tested my configured setup (the tests above were done with a fresh livestick) with 1 core + HT disabled and everything is fast, no more lags with TV Show Next Aired etc... Maybe someone knows how to fix this issue. I'm running a Core i3-3225 with the ASRock H77M-ITX.

stefansaraev commented 11 years ago

enable all cores. disable ht. ht is a myth. closing this as not openelec related.

vpeter4 commented 11 years ago

I wonder what results are with all cores but disabled ht. I would say bad as with ht.

stefansaraev commented 11 years ago

offtopic. I had very similar issue on few servers runing a "heavy" java application. supermicro boards. disabled ht (kept all cores active) - cpu usage went down from 100 to 5%. IMO HT does more harm than good on multicore..

Black09 commented 11 years ago

I tested all cores with HT disabled, doesn't work. It's working fine (fast) with 1 core only. I have HT enabled on OS X and it's working just fine in XBMC so HT is NOT the problem.

vpeter4 commented 11 years ago

Maybe it have something with dirty regions and refreshing main screen.

Black09 commented 11 years ago

I've disabled dirty regions.

stefansaraev commented 11 years ago

can you please do: dmesg | pastebinit

Black09 commented 11 years ago

http://sprunge.us/ALJe

stefansaraev commented 11 years ago

now enable all cores + ht and do it again

Black09 commented 11 years ago

http://sprunge.us/ZKUN

stefansaraev commented 11 years ago

cat /proc/cpuinfo | pastebinit

Black09 commented 11 years ago

http://sprunge.us/ZULZ

stefansaraev commented 11 years ago

thanks. seems fine to me. can you do the same test with ubuntu + xbmc ?

Black09 commented 11 years ago

I'm on it. :)

Black09 commented 11 years ago

Same problems with XBMCbuntu 12.2.

stefansaraev commented 11 years ago

so it must be either a xbmc / python bug or broken / buggy BIOS.

Black09 commented 11 years ago

I don't think it's a bios problem. Problem with linux / xbmc / python and my hardware combination seems more likely to me.

Edit: Posted this also on the xbmc forums -> http://forum.xbmc.org/showthread.php?tid=169730 I also did a test with OpenELEC on my other PC with a Core i7 2600k and the problem doesn't occur there.