Roku Developer Program

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

Delayed app by calling component interface

If I have a component and call their-own interface field or function it make a small delay like 16ms, I know it looks small but if you call several times or often it kinda big.

So let imagine you have your own component like this (myawsomecomponent.xml):
<?xml version="1.0" encoding="utf-8" ?>

<component name="myawsomecomponent" extends="Group">

  <interface>
     <field id="first" type="string" />
  </interface>

  <script type="text/brightscript" uri="pkg:/components/myawsomecomponent.brs" />

</component>


and code is doing something like this (myawsomecomponent.brs):
sub init()
  m.top.observeField("first", "get_first")
end sub

' SLOW - accessing into m.top it take 16ms '
function latelyCalledFunction() as void
  print m.top.first
end function

' improved performance - accessing into m it take 0ms '
function latelyCalledFunctionEnhanced() as void
  print m.first
end function

function get_first(event as object) as void
  m.first = event.getData()
end function


Same is if I use callFunc to execute function field.

In this case I am able to improve speed but still if I want send some data from component into component it took 16ms per each. Is there some performance effectively way to pass data from component to component?

I hope I can somehow use roMessagePort but not sure how could do that.
Platforms integration specialist
====================
@ https://suite.st/
0 Kudos
1 Reply
lkrocek
Level 7

Re: Delayed app by calling component interface

Poster working well in this case ...

Even I think it is more hack than solution I solved it by changing parent of my component which were extended from a Group, now is extended from a Poster and there is no delay.
Platforms integration specialist
====================
@ https://suite.st/
0 Kudos