Alex, didn't tell me once about the order of the actions (setStyle,
addChild) would also impact? Cant' remember what was the order but styling
and adding it as a child would also force additional invalidations.

Regarding virtual layout, do the items need to be all visible at the same
time?
I would recomend to use as the most lightweight component as possible, does
your container need to be a mx:VBox? Couldn't he simply be a s:VBox
(doesn't have any styling)?

Even to optimize it further, instead of creating all those nested
containers, you could use a s:List with a custom layout do place your
lightweight items.

On 8 December 2016 at 19:19, Alex Harui <aha...@adobe.com> wrote:

> Run a profiler to see what is taking so much time.  It could be just
> adding that many children, or it could be something each child does when
> being added that could be optimized or deferred for later.
>
> If it is just adding that many children, you could create an array of them
> and add them in bunches over several frames.
>
> -Alex
>
> On 12/8/16, 9:54 AM, "gmanupnorth" <gordoncro...@gmail.com> wrote:
>
> >This piece of code is causing significant lag in our UI and was looking
> >for
> >suggestions on how to improve it. This builds up a list of approx 1400
> >items
> >and takes 35-50 seconds to finish.
> >
> >
> >AssetTreeChild is a custom component based on the VBOX AssetTreeChild.mxml
> ><http://apache-flex-development.2333347.n4.nabble.
> com/file/n57076/AssetTre
> >eChild.mxml>
> >
> >
> >public function setAgentItem(value:SmartAgentVO):void
> >               {
> >                       this.agentItem = value;
> >                       if ( value.Children!=null &&
> value.Children.length>0 )
> >                       {
> >                                       var assetComp:AssetTreeChild;
> >                                       for each ( var item:SmartAgentVO
> in value.Children )
> >                                       {
> >                                               assetComp = new
> AssetTreeChild();
> >                                               list.addChild(assetComp);
> >
>  assetComp.setAgentItem(item);
> >                                               assetComp.setStyle("
> textIndent",7);
> >                                       }
> >                               }
> >               }
> >
> >
> >
> >--
> >View this message in context:
> >http://apache-flex-development.2333347.n4.nabble.
> com/Slow-performance-1000
> >-objects-tp57076.html
> >Sent from the Apache Flex Development mailing list archive at Nabble.com.
>
>


-- 

João Fernandes

Reply via email to