Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
winmill
Level 7

CreateObject roBitmap execution time

I tracked down my app's response lag to the CreateObject("roBitmap") call. This call seems to have a wide range of execution times on devices I can test.

On most recent devices (e.g. 3930X), it takes 72ms. However, on a recent 55" TCL (55S525), this call takes 551ms. I tried a factory reset, but still see same results.

Here's the code that I've inserted into hello-world to test.

timer = CreateObject("roTimespan")
timer.Mark()
bitmap = CreateObject("roBitmap", {width: 146, height: 146, AlphaEnable: true})
bitmap.Finish()
print "Device roBitmap create: " + timer.TotalMilliseconds().ToStr() + "ms"


Why would this call take so long on a device?

 

0 Kudos
3 REPLIES 3\
necrotek
Level 11

Re: CreateObject roBitmap execution time

Not sure why it would take so long and don't have a Roku tv to test... but why are you calling bitmap.Finish() if you have not drawn anything to the bitmap?  I do not use bitmap.finish() and have never had an issue.  If you are using a roScreen with double buffer I think it will do a finish before swapbuffers(). You will only have this "execution time" hit when creating. Draws are done quickly. 

2nd possibility is that the new Roku tvs' and roku ultras do have new chips and draw2d drivers have not been implemented exactly the same as the older devices.  I have a new Roku ultra and have not encountered any issues with slow bitmap creation that I have noticed but there is a scaling issue with non HD roScreen. 

 

0 Kudos
winmill
Level 7

Re: CreateObject roBitmap execution time

Thanks for the point on the bitmap.Finish(). Removing that takes 20ms from the execution time.

The 55" TCL is still at 531ms for the CreateObject("roBitmap") call. The Roku model number is A105X, so it's an A000X device in the hardware specs table.

I did get a chance to run this on a 40" TCL (an 8000X device). It ran in 79ms after removing the bitmap.Finish() call.

The 55" TCL A000X device has good specs on the hardware table, but seems to take a long time to create a bitmap.

0 Kudos
winmill
Level 7

Re: CreateObject roBitmap execution time

More diagnostics. This code snippet now runs in 3ms on the 55" TCL.

'screen = CreateObject("roSGScreen")
screen = CreateObject("roScreen", true)
timer = CreateObject("roTimespan")
timer.Mark()
bitmap = CreateObject("roBitmap", {width: 146, height: 146, AlphaEnable: true})
bitmap.Finish()
print "Device roBitmap create: " + timer.TotalMilliseconds().ToStr() + "ms"

If I change the comment lines and use the line with "roSGScreen" instead of "roScreen", then it takes 518ms.

So, it seems that using SceneGraph increases CreateObject("roBitmap") from 3ms to 518ms.

0 Kudos