"Komag" wrote:
What Roku model number are you using? Text and alpha transparency are a couple things that hurt performance a lot in general. I don't know the impact of getting the date and time.
You might set up a test function to make a timer, get the date and time 100 or 1000 times, then print the timer results. I've used this approach on lots of functions to really tell me how long it's taking for various things, and it can be eye opening at times.
"TheEndless" wrote:
I wouldn't expect grabbing the time to impact performance, but it should be an easy test. Have you commented that part out to see if performance improves?
There's nothing on that keyboard screen that I'd expect to cause any performance issues, so my guess is there's something in your code that's causing the problems. Are you caching and re-using the font? Initializing a font is pretty slow, so if you're not re-using it, that could definitely be the issue.
On a side note, that's a nice, clean layout. I like it!
"JordanT92" wrote:
They aren't running slow by any measure, it all runs quite well actually, but it just feels that the default roku screen can navigate from letter to letter faster than my screen
"JordanT92" wrote:
Thank you very much! It's a redesign of my current app, I'm having an issue with roGridScreen where the focused item flickers back and forth between two items randomly and I can't find any way to stop it, so I'm redesigning it from scratch using roScreen. A lot of work it seems! But I'm getting there....
"TheEndless" wrote:"JordanT92" wrote:
They aren't running slow by any measure, it all runs quite well actually, but it just feels that the default roku screen can navigate from letter to letter faster than my screen
FWIW, with the built-in SDK screens, the UI runs in a separate thread from the BrightScript code, so it'll be smoother, by default, especially on slower boxes. I wouldn't get too hung up on matching performance on the Roku 1 box. You'll be hard pressed to get there on any of the 27XX boxes with a lot of elements on the screen. Assuming each key on the keyboard is a separate bitmap, if you cached the whole keyboard to a single bitmap first instead of drawing each key individually each frame, and only updated the highlighted key, that would likely help a lot."JordanT92" wrote:
Thank you very much! It's a redesign of my current app, I'm having an issue with roGridScreen where the focused item flickers back and forth between two items randomly and I can't find any way to stop it, so I'm redesigning it from scratch using roScreen. A lot of work it seems! But I'm getting there....
There was a bug in the 6.0 and 6.1 firmware that caused the grid screen focused index to jump around when returning to the screen. I don't know if that's what you were experiencing or not, but I believe it was fixed in 6.2.
"JordanT92" wrote:
That's good to know! I'm surprised at how well the Now TV Box runs it to be honest, my screens will never get too crowded as I'm going for a more simplistic approach. Currently some items are drawn off screen and scroll into view later, I'll ensure they're only drawn when in the bounding box of the screen and I think the performance on most screens will be pretty decent then, even on the lower end boxes. For the Roku 1, i think disabling animation altogether may be the only way to go... I'm running the latest version (no choice of course) and it still happens, although this is a grid with 11,000+ item (any items out of view are set to invalid).
"JordanT92" wrote:
My next questions is... To speed things up from a data standpoint, I want my app to download a ZIP / JSON file on startup, and use that as the central database for everything, so the only time any network activity would occur is when grabbing images. The only problem is, this file is likely to be around the 20MB mark... Do you think the boxes would be alright with this if I limit playback to 720p? Or would I run out of memory? I can't seem to find a way of getting my current memory usage...
"JordanT92" wrote:
I can't seem to find a way of getting my current memory usage...
Sub Main ()
memstats = new_MemStats ()
stats = memstats.Stats ()
Print stats
bm = CreateObject ("roBitmap", {Width:1000, Height:1000, AlphaEnable: False})
stats = memstats.Stats ()
Print stats
bm1 = CreateObject ("roBitmap", {Width:1000, Height:1000, AlphaEnable: False})
stats = memstats.Stats ()
Print stats
memstats.Close ()
End Sub
Function new_MemStats () As Object
this = {}
this.re = CreateObject ("roRegex", "memory (\d+) used (\d+)", "")
this.port = CreateObject ("roMessagePort")
this.sa = CreateObject ("roSocketAddress")
If Not this.sa.SetAddress ("127.0.0.1:8080")
Print "SetAddress Failed"
Return Invalid
EndIf
this.ss = CreateObject ("roStreamSocket")
If Not this.ss.SetSendToAddress (this.sa)
Print "SetSendToAddress Failed"
Return Invalid
EndIf
this.ss.SetMessagePort (this.port)
crlf = Chr (13) + Chr (10)
this.r2d2_bitmaps = "r2d2_bitmaps" + crlf
this.quit = "quit" + crlf
this.prompt = crlf + ">"
If this.ss.Connect ()
this.ss.ReceiveStr (1024)
Else
Print "Connection Error: "; this.ss.Status ()
Return Invalid
EndIf
this.Stats = Function () As Object
m.ss.SendStr (m.r2d2_bitmaps)
rsp = ""
While True
rsp = rsp + m.ss.ReceiveStr (1024)
If Len (rsp) < 3 Or Right (rsp, 3) = m.prompt
Exit While
EndIf
End While
ma = m.re.Match (rsp)
If ma.Count () = 3
Return {avail: ma [1], used: ma [2]}
Else
Return {avail: 0, used: 0}
EndIf
End Function
this.Close = Function () As Void
m.ss.SendStr (m.quit)
m.ss.Close ()
End Function
Return this
End Function
"TheEndless" wrote:"JordanT92" wrote:
That's good to know! I'm surprised at how well the Now TV Box runs it to be honest, my screens will never get too crowded as I'm going for a more simplistic approach. Currently some items are drawn off screen and scroll into view later, I'll ensure they're only drawn when in the bounding box of the screen and I think the performance on most screens will be pretty decent then, even on the lower end boxes. For the Roku 1, i think disabling animation altogether may be the only way to go... I'm running the latest version (no choice of course) and it still happens, although this is a grid with 11,000+ item (any items out of view are set to invalid).
Sorry, I was specifically referring to the keyboard screen. If every key is being drawn separately, that means you're drawing 38 separate keys on each pass, with 38 separate calls to DrawText. If you drew the whole thing to a bitmap first, then just updated the focus rect on each frame, that would likely significantly improve performance. There's no reason you shouldn't be able to do animation on the Roku 1 for that screen.
"TheEndless" wrote:"JordanT92" wrote:
My next questions is... To speed things up from a data standpoint, I want my app to download a ZIP / JSON file on startup, and use that as the central database for everything, so the only time any network activity would occur is when grabbing images. The only problem is, this file is likely to be around the 20MB mark... Do you think the boxes would be alright with this if I limit playback to 720p? Or would I run out of memory? I can't seem to find a way of getting my current memory usage...
Yeesh.. I don't know how that would work out for you. 20MB may be too large for tmp: storage. That should be independent of graphics and video memory, though.
"belltown" wrote:"JordanT92" wrote:
I can't seem to find a way of getting my current memory usage...
For some reason, Roku doesn't want you to know anything about memory usage. You can, however, use the r2d2_bitmaps command, issued to port 8080 to get some information about memory usage (at least for your bitmaps).
If you wish to access that information programmatically, it's possible although rather kludgy, e.g:truncated...
"JordanT92" wrote:"belltown" wrote:"JordanT92" wrote:
I can't seem to find a way of getting my current memory usage...
For some reason, Roku doesn't want you to know anything about memory usage. You can, however, use the r2d2_bitmaps command, issued to port 8080 to get some information about memory usage (at least for your bitmaps).
If you wish to access that information programmatically, it's possible although rather kludgy, e.g:truncated...
That's some useful information right there! I'll give that a go.
Thanks both.