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

8 次查看(过去 30 天)
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

回答(1 个)

arushi
arushi 2024-9-4
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!

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by