A few things regarding execution speed versus display speed

2 messages - 652 views

In my application the number of different frames/screens is rapidly growing. I noticed that if I made the frame switch so that each time the frame was removed it would destroy the screen and recreate it next time it was shown, the speed at which the screen was displayed could have been a bit better (not that it was slow even with that technique). So I replaced it so that the screen is kept in memory and the screen is just displayed according to which frame we are viewing. Everything works just fine and now the UI is noticeably faster. But one thing that I noticed was that even though the screen is not currently displayed, it still gets the updates from the data provider.. Is this by design ? Wouldn't it be more resource effective to seize fetching the data from the provider while the screen is not being displayed ? And also, should widget.isVisible() really return true even though the screen it is in is not currently visible ? I was trying to make a modification to the data provider where it only dispatches the update events when widget.isVisible() == true, but it seems that it is always true, unless I explicitly set it to false..

Right, rebuild screen each time you need to display it could be slower than keep it in memory. Here you need to choice between memory usage an perfomances.

Widget visibility need to be split in two part.

  1. The widget is set as visible=true but one of its parent is set to visible=false. In this case Widget.isVisible() returns false.
  2. The widget is set as visible=true as its parents. But the Desktop is not the root parent (typicaly you case while the screen is not displayed). In this case Widget.isVisible() returns true. But Widget.isInWidgetTree() return false !

To be clear, Widget.isVisible() permit to know if the widget is set has visible, and Widget.isInWidgetTree() permit to know if the widget is being process while relayouting and repainting the display.

Else, DataProvider updates binded widgets even if they aren't inWidgetTree, because in this case they are always valid and no full update is needed when they are in widget tree again.

It's right that it can be a wast of tine in some case, but for exemple, rebuilding a full list even if nothing as changed is not beter.