Your Digital Media Has Never Looked So Good

 
Romans_I_XVI
Topic Author
Posts: 234
Joined: Wed Nov 19, 2014 10:25 pm
Contact:

OS 7.6 Update Performance Drop

Tue May 16, 2017 7:33 am

Hey there, so I've been working on a game which all of a sudden started running at 40 fps rather than a consistent 60 fps for no apparent reason. It took me a while to realize that it was because my Roku updated. I realized this because I tried another Roku which hadn't recieved the update and it worked fine, until I updated that Roku as well and I was back to 40 fps.

I originally thought maybe this had something to do with the new profiler running in the background so I created a temporary private channel so the game wouldn't be side loaded, but it ran the same. I tried to narrow it down to which parts of my code were the most time consuming and couldn't find anything specific until I tried putting a timer on this one method...

timer = CreateObject("roTimespan")
m.screen.SwapBuffers()
print timer.TotalMilliseconds()


And here's what the results looked like.
 20
 6
 22
 7
 5
 22
 23
 7
 5
 22
 6
 22
 7
 21
 7
 22
 7
 22
 7
 20
 7
 21
 6
 22
 7


It's almost perfectly alternating between being ~7ms one frame and 20+ms the next.  Well 16.666ms between each frame would be 60fps so just this one call alone is taking longer than that.

Anyone have any thoughts on this? I also put a timer on my entire game loop, where all of the logic and drawing to the screen occurs, and the total for all of it is never greater than 10ms which is easily a consistent 60fps. It's the SwapBuffers() call that is killing me.
Last edited by Romans_I_XVI on Tue May 16, 2017 4:00 pm, edited 1 time in total.
 
User avatar
squirreltown
Posts: 747
Joined: Sun Apr 21, 2013 2:20 pm

Re: OS 7.6 Update Performance Drop

Tue May 16, 2017 9:25 am

Something changed. All my stuff is 2D API and the only way i can describe it is that it's as if roScreen is being given less CPU time. I've had to "optimize" things that worked just fine before to keep the screen from flashing. I've noticed flashing on the Home screen too.
Kinetics Screensaver (kineticsscreensaver), Kinetics³ Screensaver(kinetics3), Kinetics Painter Screensaver (kineticspainter), Kinetics Splash Screensaver (kineticssplash)
 
User avatar
RokuNB
Posts: 298
Joined: Fri Mar 31, 2017 2:22 pm

Re: OS 7.6 Update Performance Drop

Tue May 16, 2017 9:55 am

Romans_I_XVI - what player (model#?) did you measure this on?
What do the results look like if you try on some other models?
 
Romans_I_XVI
Topic Author
Posts: 234
Joined: Wed Nov 19, 2014 10:25 pm
Contact:

Re: OS 7.6 Update Performance Drop

Tue May 16, 2017 10:10 am

Hey there, I tried this on two Roku 3's with the same results. One is Model #4230X1 and the other is Model #4200X. I could try it on my older stick and Roku 1 lol, but those are very outdated and underpowered in the first place. I still need to buy a Roku from the newer line, I don't have any of those to test on unfortunately.

Maybe squirreltown can confirm the issue on other models beyond what I own?
 
User avatar
squirreltown
Posts: 747
Joined: Sun Apr 21, 2013 2:20 pm

Re: OS 7.6 Update Performance Drop

Tue May 16, 2017 10:18 am

Romans_I_XVI wrote:
Maybe squirreltown can confirm the issue on other models beyond what I own?

Would love to but mine are 4200X's too. That said, the behavior was exactly the same on all 3 that I have.
Kinetics Screensaver (kineticsscreensaver), Kinetics³ Screensaver(kinetics3), Kinetics Painter Screensaver (kineticspainter), Kinetics Splash Screensaver (kineticssplash)
 
Romans_I_XVI
Topic Author
Posts: 234
Joined: Wed Nov 19, 2014 10:25 pm
Contact:

Re: OS 7.6 Update Performance Drop

Tue May 16, 2017 10:23 am

Alright, well I might just go ahead and go buy a newer one today, I've been needing to anyway. I can give results on that later tonight.
 
User avatar
destruk
Posts: 2503
Joined: Sat Dec 18, 2010 4:58 pm

Re: OS 7.6 Update Performance Drop

Tue May 16, 2017 10:31 am

The profiler shouldn't be a problem unless you specifically specified it to run in the manifest.
 
User avatar
Komag
Posts: 677
Joined: Fri Aug 22, 2014 3:42 am

Re: OS 7.6 Update Performance Drop

Tue May 16, 2017 3:40 pm

I'm very interested in this issue and it's resolution.

Romans_I_XVI, I'm curious about your test results - why would it have that alternating pattern usually but not always? Some of them were two short ones in a row or two long ones in a row, very odd.
 
Romans_I_XVI
Topic Author
Posts: 234
Joined: Wed Nov 19, 2014 10:25 pm
Contact:

Re: OS 7.6 Update Performance Drop

Tue May 16, 2017 3:57 pm

Yeah I thought it was very odd too Komag.

Also, I just went out and bought a new Roku Stick and although I can't compare pre 7.6 performance I can say it's not doing the weird alternating timing on the swapbuffers(). The game actually runs better on the stick, with a constant 55 FPS and the SwapBuffers() takes a consistent 15ms during gameplay. Again, I'm not sure if it would have run better pre update or not, but again I do get better performance on the stick than on the Roku 3.
 
User avatar
RokuNB
Posts: 298
Joined: Fri Mar 31, 2017 2:22 pm

Re: OS 7.6 Update Performance Drop

Tue May 16, 2017 6:39 pm

Can you guys please try the following on different players and let me know the results?
scr = createObject("roScreen", true)
tm = createObject("roTimeSpan")
delays = []
for i = 1 to 100
    tm.mark()
    scr.clear(rnd(2^31))
    scr.swapBuffers()
    delays.push(tm.totalMilliSeconds())
next
? delays

I just tried it with fw7.6.4120 on #4640 and #2500 models and it seems to return about consistent 16 (+/-1) ms, no "vibrato" like the above.

I am not saying it's not happening - rather trying to collect data on where and how.
 
Romans_I_XVI
Topic Author
Posts: 234
Joined: Wed Nov 19, 2014 10:25 pm
Contact:

Re: OS 7.6 Update Performance Drop

Tue May 16, 2017 7:50 pm

To reproduce the numbers I mentioned you could do something like this.

scr = createObject("roScreen", true, 1280, 720)
tm = createObject("roTimeSpan")
delays = []
for i = 1 to 100
    tm.mark()
    scr.clear(rnd(2^31))
    for k = 0 to 100
           scr.DrawRect(rnd(1000), rnd(1000), rnd(1000), rnd(1000), rnd(2^31))
    end for
    scr.swapBuffers()
    delays.push(tm.totalMilliSeconds())
next
? delays


I added in 100 rectangle draw calls. I know 100 draw calls per loop is a bit much for the Roku regardless, but how does this effect how much time it takes to call swapbuffers()? The output of this will be alternating between ~16ms and ~33ms but the inconsistency is not the fault of the draw calls, if you move the timer to just check how much time it takes to process the 100 draw calls you will get a consistent 7ms (aside from a few hiccups).

I feel like something might be going wonky with swapbuffers() and it's relation to vsync? But that of course is just a wild guess, I only say that because it jumps from 16ms to 33ms which would be the next frame of a TV running at 60Hz, it's like it's skipping frames.
 
User avatar
squirreltown
Posts: 747
Joined: Sun Apr 21, 2013 2:20 pm

Re: OS 7.6 Update Performance Drop

Wed May 17, 2017 9:26 am

RokuNB wrote:
Can you guys please try the following on different players and let me know the results?

 i ran this on my 4200x and got [ 30, 10, then 16's to the end.]

Romans_I_XVI, my experience has been that it's the amount of pixels being drawn that is significant. I'm sure the number of calls matter at some point but I have a screensaver with a full-screen background region, and 300+ "dots" that fly around in a flock. The dots scale up and down from 5 to 20 pixels. I have it set at 360 dots now, but it doesn't start stuttering until I get over 400. Now, that said, the limit of full screen images that can be run at the same time seems to be 5.

when i ran your version I got [ 74,33,56,27,16,39,27,39,27,16,33,39,16, like that to the end. ( looks kind of cool too.)
Kinetics Screensaver (kineticsscreensaver), Kinetics³ Screensaver(kinetics3), Kinetics Painter Screensaver (kineticspainter), Kinetics Splash Screensaver (kineticssplash)
 
User avatar
RokuMarkn
Roku Engineering
Posts: 1582
Joined: Mon Jun 09, 2008 9:20 am

Re: OS 7.6 Update Performance Drop

Wed May 17, 2017 10:06 am

There was a performance problem identified in 7.6 related to frame swapping that affects only 42xx models.  Has anyone seen this issue in any non-42xx models?  If it's only appearing on 42xx models, it sounds like the same problem.  The fix has been implemented but has not yet been released.

--Mark
 
Romans_I_XVI
Topic Author
Posts: 234
Joined: Wed Nov 19, 2014 10:25 pm
Contact:

Re: OS 7.6 Update Performance Drop

Wed May 17, 2017 10:40 am

Ah that sounds like exactly the same issue RokuMarkn. I don't have a ton of models to test but so far it appears to just be 42xx models. I know the Roku Stick I just bought seems to work as expected. I'm glad to hear the problem has been identified and fixed! I'll probably just continue development as planned and wait for that fix ;)
 
User avatar
RokuNB
Posts: 298
Joined: Fri Mar 31, 2017 2:22 pm

Re: OS 7.6 Update Performance Drop

Wed May 17, 2017 1:53 pm

Running Romans' code on #4640 i get the 16 (+/-1)ms and on #2500 i get
40 27 32 30 41 35 31 35 39 33 34 32 32 29 32 33 31 27 33 34 29 32 34 32 32 33 31 29 30 33 32 34 32 34 32 34 35 33 30 32 29 36 32 32 30 30 32 33 31 32 31 30 30 33 32 32 27 46 27 34 36 35 29 34 31 32 32 31 34 44 31 31 32 33 35 31 33 30 31 33 30 32 32 31 35 30 30 29 29 30 32 34 37 33 34 30 32 30 30 35
which seems... okay for a slow player.

On a 4230 w/7.6.4120 though i get the "ringing":
90 33 55 27 23 49 27 16 16 33 55 27 16 16 33 16 33 16 39 28 32 39 27 16 33 33 39 27 16 33 16 33 16 16 33 16 33 16 33 16 49 39 27 16 33 16 33 16 33 16 33 16 16 33 16 33 16 39 27 16 33 16 33 16 33 16 33 32 33 16 33 16 33 16 33 16 33 16 33 16 50 50 33 16 33 16 33 16 33 16 16 33 16 33 16 33 16 33 16 33

Same 4230 w/7.5.4099 seems "more stable":
70 26 39 15 25 53 24 32 20 30 41 23 20 31 31 22 27 34 31 26 50 18 21 30 19 31 22 30 32 33 30 22 30 28 24 30 30 21 28 19 73 18 25 31 31 21 29 18 33 28 19 20 28 21 30 22 26 22 29 21 33 27 22 27 23 26 22 26 21 28 21 30 19 33 32 30 21 28 19 29 34 56 21 20 18 23 27 20 27 23 28 22 27 33 22 25 20 32 33 35

But if you calculate the average time per frame, it remains 27ms for both. What has changed is the delta between two frames - the avg.absolute value for 7.5 was 9ms and is 15ms for 7.6. From what i see, performance has not dropped but some frames take longer, where other take shorter by the same amount

Who is online

Users browsing this forum: No registered users and 3 guests