Why does a checkbox UI Tree take so much longer to populate the widget than a normal UI Tree?

2 views (last 30 days)
I have a uitree that is displaying over 9000 parameters. The widget for the uitree that is displayed takes ~6 seconds to populate as a normal ui tree (which already feels like a very long time to take to load), compared to 1 minute and 55 seconds for a checkbox ui tree to populate the exact same data.
Also, this time is not captured within script runtime using tic and toc. The script is considered "finished" and then the times mentioned above are how long it takes for the opened figure to actually popuate the parameters to the ui tree widget.
example of my code that creates the tree:
f = uifigure();
tree = uitree(f, 'checkbox');
for family=string(parameterTable.Properties.VariableNames)
newFamilyNode = uitreenode(tree,'Text', family);
params = string(parameterTable.(family));
params = rmmissing(params);
for i=1:length(params)
newParamNode = uitreenode(newLruNode,'Text', params{i});
end
end

Answers (1)

Gagan Agarwal
Gagan Agarwal on 26 Sep 2023
Hi Austin Burritt,
I understand that you are trying to understand why the checkbox uitree takes longer time to render than the normal uitree for the same data.
The difference in loading time could be due to several factors please refer to few possible reasons listed: -
  1. Rendering Complexity: A checkbox uitree typically requires additional rendering operations compared to a normal UI tree. Each checkbox element is created and rendered individually, which increases the overall rendering complexity and, consequently, the loading time.
  2. Event Handling: Checkbox uitree often involve event handling for each checkbox element which contributes to the longer loading time.
  3. Data Structure: The underlying data structure used for the checkbox uitree is more complex than the one used for the normal uitree. This complexity leads to additional processing time for populating the checkbox uitree.
For additional information regarding uitree, please refer to the following documentation: -
I hope this helps!

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!