Forum Discussion

lkrocek's avatar
lkrocek
Binge Watcher
8 years ago

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.

1 Reply

  • lkrocek's avatar
    lkrocek
    Binge Watcher
    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.