You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by codekarma <co...@gmail.com> on 2014/08/20 01:42:02 UTC

TitleWindow severe performance problem (>15 sec to update)

Hi All,

I have a question about severe performance degradation ~15 seconds when
adding a component to a spark TitleWindow dynamically. Any pointers/help on
how to sort this would be a big help.

Say, UIPanel is a custom component with several children. The app creates a
spark TitleWindow using the PopupManager. The TitleWindow contains a HGroup
child that contains an Accordion on the left hand side with different forms
and a ViewStack on the right hand side with various components and one of
these is the UIPanel. When clicking the Accordion, the Viewstack shows
different components and lets the user configure the component using one of
the forms.

When I click the Accordion's tab corresponding to the UIPanel it takes an
awful long time. It's very slow and also sometimes I can see some unrelated
stuff on the stage getting updated slowly.

Adding the same UIPanel to another container dynamically via a Button is
fast. Furthermore its only slow the first time the UIPanel is created. If
the UIPanel was created earlier before the TitleWindow was even created it
adds it fast. Even if the another instance of the TitleWindow is created at
a later stage it add the component very fast it's just happening the very
first instantiation. 

This component has a static method called when the first instance of object
is created as mentioned in 
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf687e7-7ff6.html#WS2db454920e96a9e51e63e3d11c0bf69084-79d9.
However the profiler doesn't show this taking too much time (< 40 ms).The
profiler shows most of the time being taken in enterFrameEvent and some in
pre-render & render.
Subsequent runs take a much smaller time for these. 

The component does use setStyle on of its children but that child doesn't
have any further children and I don't see it using anything in the profiler.

Again, if anyone can give me some pointers/inputs would be a really big
help!



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/TitleWindow-severe-performance-problem-15-sec-to-update-tp7677.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: TitleWindow severe performance problem (>15 sec to update)

Posted by codekarma <co...@gmail.com>.
Thanks so much for the inputs. Lot of good information. (This forum has more
info than most books i've seen so far).

I will follow the invalidation calls to see if I find something.

The peculiar problem though is that when I add my custom component to any
other container dynamically there is no slow down it happens in < 200 ms.
Also, if the component is first added to another container and then added to
the TitleWindow it also happens < 200 ms.

It's the combination of adding the component for the first time (creation
and adding to the displayList) to the TitleWindow that there is the enormous
slow down.

I will trace through the validation calls to see if it being called anywhere
inside the TitleWindow.

Thanks again!



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/TitleWindow-severe-performance-problem-15-sec-to-update-tp7677p7880.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: TitleWindow severe performance problem (>15 sec to update)

Posted by Alex Harui <ah...@adobe.com>.
And the numbers show 49 layout passes.  Your goal is to try to get it down
to 1 or 2.

I don't see UIComponent.initialize in the list which is probably a good
thing.  That measures the number of widgets created.  But please scroll
down and find it and let me know what the call count is (just need the
number, not a screenshot).  I'm going to guess it is in around 90, which
would be good to make a smaller number, but it might not be the main
culprit.  The framework should be able to create and layout 90 components
in under a second in many cases.

Unclear why there are 49 layout passes.  I don't know of any easy ways to
find out.  I usually monkey patch LayoutManager and remove the comments
and check the trace output from all of the invalidation calls.  It is a
ton of data but by rummaging through it you'll see doPhasedInstantiation
calls then more invalidateProperties, invalidateSize,
invalidateDisplayList calls.  Those are components that are getting
modified somehow and need another pass.   If you see the same components
in several passes, that's where I look first.

But before you go and do all of that, here's some causes of multiple
layout passes than I can think of OTOH:

1) asynchronous loading.  If you have data or assets coming in over the
network, they do need another layout pass when they arrive.  But
hopefully, the asynchronous results don't come in over 49 different frames.
2) ConstraintLayout.  I saw it in there, and it can be the cause of a
performance problem.  Do you really need it?  There might be a cheaper way
to replace it with.
3) Unbounded sizes.  When things have percentage sizes, they get measured
and if their measurements are not stable, you'll get multiple passes
4) Multi-line text and other "flow" layouts.  Multi-line text can be any
dimension.  Locking down the width (or height) can eliminate multiple
layout passes.

HTH,
-Alex

On 8/21/14 5:37 PM, "codekarma" <co...@gmail.com> wrote:

>Sorry, I cleared the filters now an uploaded it  here
><http://imgur.com/HCEIjak>
>
>Now you can see the mx and spark classes.
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/TitleWindow-severe-performa
>nce-problem-15-sec-to-update-tp7677p7690.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: TitleWindow severe performance problem (>15 sec to update)

Posted by codekarma <co...@gmail.com>.
Sorry, I cleared the filters now an uploaded it  here
<http://imgur.com/HCEIjak>  

Now you can see the mx and spark classes.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/TitleWindow-severe-performance-problem-15-sec-to-update-tp7677p7690.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: TitleWindow severe performance problem (>15 sec to update)

Posted by Alex Harui <ah...@adobe.com>.
Interesting.  This would be the first time I've seen TLF overwhelm the
LayoutManager.  Are you sure filters are turned off?  If you scroll down
you should see mx or spark packages/classes in the list.

If you have filters turned off, then I would set a breakpoint on
TextContainerManager.compose() and see what is on the call stack when it
is called.  Could the corelogiq components be using TLF internally?

Spark Labels use FTE, but not TLF.  Spark RichText, RichEditableText,
TextInput and TextArea use TLF but they should have shown up in this
screenshot.

-Alex

On 8/21/14 3:54 PM, "codekarma" <co...@gmail.com> wrote:

>Hi, Thanks for the pointers.
>
>I've uploaded another screen shot  here <http://imgur.com/fS4AFou>   with
>all the filters removed.
>
>I checked to make sure the creationPolicy is auto everywhere. Also, the
>slowdown only happens when I click the last item in the Accordion which is
>when my custom component gets created.
>
>I've only used spark Labels and they don't use the TLF? There is an
>advanced
>data grid on the stage but doesn't come under the TitleWindow in which my
>custom component is located.
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/TitleWindow-severe-performa
>nce-problem-15-sec-to-update-tp7677p7687.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: TitleWindow severe performance problem (>15 sec to update)

Posted by OmPrakash Muppirala <bi...@gmail.com>.
Just curious, did you try building a 'Release' version of the swf?  I have
seen some functionality really slow down with the default debug builds.

Thanks,
Om


On Thu, Aug 21, 2014 at 3:54 PM, codekarma <co...@gmail.com> wrote:

> Hi, Thanks for the pointers.
>
> I've uploaded another screen shot  here <http://imgur.com/fS4AFou>   with
> all the filters removed.
>
> I checked to make sure the creationPolicy is auto everywhere. Also, the
> slowdown only happens when I click the last item in the Accordion which is
> when my custom component gets created.
>
> I've only used spark Labels and they don't use the TLF? There is an
> advanced
> data grid on the stage but doesn't come under the TitleWindow in which my
> custom component is located.
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/TitleWindow-severe-performance-problem-15-sec-to-update-tp7677p7687.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Re: TitleWindow severe performance problem (>15 sec to update)

Posted by codekarma <co...@gmail.com>.
Hi, Thanks for the pointers.

I've uploaded another screen shot  here <http://imgur.com/fS4AFou>   with
all the filters removed.

I checked to make sure the creationPolicy is auto everywhere. Also, the
slowdown only happens when I click the last item in the Accordion which is
when my custom component gets created.

I've only used spark Labels and they don't use the TLF? There is an advanced
data grid on the stage but doesn't come under the TitleWindow in which my
custom component is located.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/TitleWindow-severe-performance-problem-15-sec-to-update-tp7677p7687.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: TitleWindow severe performance problem (>15 sec to update)

Posted by Alex Harui <ah...@adobe.com>.
Hi,

I forgot to mention that you should turn off all filters in the profiler
so we can see global classes and the SDK classes.

But just from this information, you can see that there are 143
TextContainerManager.updateContainer calls.  In new instances, measurement
and layout can end up calling updateContainer, but that implies that there
are 71 text widgets using TLF on the screen, or else something is causing
more than one layout pass.  I only see about 26 or so things that look
like Labels that shouldn't be using TLF.   Turning off the filters should
show us how many layout passes there were, and how many UIComponents were
instantiated.  Often, folks are using creationPolicy="all" to save on
development hassle and end up paying the price in performance.

-Alex



On 8/19/14 8:00 PM, "codekarma" <co...@gmail.com> wrote:

>Thanks for the response, here are the screenshots:
>
>profiler screenshot <http://imgur.com/QqzV7xo>
>ui screenshot <http://imgur.com/OMvJu7t>
>
>(In order to make it more apparent all the items on the stage I did on the
>TitleWindow setStyle("modalTransparency", 0);
>setStyle("modalTransparencyBlur", 0); but profiler output is from after
>that
>so it doesn't impact the profiler numbers)
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/TitleWindow-severe-performa
>nce-problem-15-sec-to-update-tp7677p7680.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: TitleWindow severe performance problem (>15 sec to update)

Posted by codekarma <co...@gmail.com>.
Thanks for the response, here are the screenshots:

profiler screenshot <http://imgur.com/QqzV7xo>  
ui screenshot <http://imgur.com/OMvJu7t>  

(In order to make it more apparent all the items on the stage I did on the
TitleWindow setStyle("modalTransparency", 0);
setStyle("modalTransparencyBlur", 0); but profiler output is from after that
so it doesn't impact the profiler numbers)



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/TitleWindow-severe-performance-problem-15-sec-to-update-tp7677p7680.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: TitleWindow severe performance problem (>15 sec to update)

Posted by Alex Harui <ah...@adobe.com>.
Post a screenshot of the profiler output.  Don't attach it to this thread
as attachments get filtered out.  Post the screenshot somewhere else and
reply with a link to it.  Also post a screenshot of the UI if you can.
Feel free to obfuscate text and graphics.

-Alex

On 8/19/14 4:42 PM, "codekarma" <co...@gmail.com> wrote:

>Hi All,
>
>I have a question about severe performance degradation ~15 seconds when
>adding a component to a spark TitleWindow dynamically. Any pointers/help
>on
>how to sort this would be a big help.
>
>Say, UIPanel is a custom component with several children. The app creates
>a
>spark TitleWindow using the PopupManager. The TitleWindow contains a
>HGroup
>child that contains an Accordion on the left hand side with different
>forms
>and a ViewStack on the right hand side with various components and one of
>these is the UIPanel. When clicking the Accordion, the Viewstack shows
>different components and lets the user configure the component using one
>of
>the forms.
>
>When I click the Accordion's tab corresponding to the UIPanel it takes an
>awful long time. It's very slow and also sometimes I can see some
>unrelated
>stuff on the stage getting updated slowly.
>
>Adding the same UIPanel to another container dynamically via a Button is
>fast. Furthermore its only slow the first time the UIPanel is created. If
>the UIPanel was created earlier before the TitleWindow was even created it
>adds it fast. Even if the another instance of the TitleWindow is created
>at
>a later stage it add the component very fast it's just happening the very
>first instantiation.
>
>This component has a static method called when the first instance of
>object
>is created as mentioned in
>http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf687e
>7-7ff6.html#WS2db454920e96a9e51e63e3d11c0bf69084-79d9.
>However the profiler doesn't show this taking too much time (< 40 ms).The
>profiler shows most of the time being taken in enterFrameEvent and some in
>pre-render & render.
>Subsequent runs take a much smaller time for these.
>
>The component does use setStyle on of its children but that child doesn't
>have any further children and I don't see it using anything in the
>profiler.
>
>Again, if anyone can give me some pointers/inputs would be a really big
>help!
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/TitleWindow-severe-performa
>nce-problem-15-sec-to-update-tp7677.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.