Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lkrocek
Binge Watcher

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 1
lkrocek
Binge Watcher

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
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.