13 Replies Latest reply on Jan 19, 2012 11:00 PM by Flex harUI

    Help with Profiler

    jfb00 Level 3

      Hi,

      I have 3 tab navigators and in each tab navigator i have other 3 more tab navigators, in each tab i have MX advanced datagrids, i have an extra tab navigator with 3 advanced datagrids.

      So total I have 30 MX advanced datagrids.

      When I call the app I do not load any data to those datagrids, I have a comboBox with options in the option is selected them I load the data to all datagrids.

      In profiler I can see that the first time the peak and current memory go to aprox 23,000 K.

      The application takes about 2 minutes to upload, why? I don't have any data loaded.

      if I run the comboBox option the peak and current memory go up to 58,000 K, also take more than 2 minutes to load the data.

      It is a way to make the application to load faster? It should be a way to improve this...

      Thanks!

       

      Johnny

        • 1. Re: Help with Profiler
          Flex harUI Adobe Employee

          Use the profiler to see how many ADGs are being created.  With the default creationPolicy, it should be only the one visible one.  Otherwise, find out why others are being created.

          • 2. Re: Help with Profiler
            jfb00 Level 3

            Alex, in profiler i see a list 30 instances created.

            I have create policy = "all" in all my tabs. I will remove that.

            Thanks!

            • 3. Re: Help with Profiler
              jfb00 Level 3

              Alex,

              I delete all create policy = "all" but still loading the 30 ADGs.

              i did a clean project and delete browser cache but nothing.

              I am new using profiler, it is a way to dig more about this?

              Thanks!

              • 4. Re: Help with Profiler
                jfb00 Level 3

                I found this link

                http://forums.adobe.com/message/3995715

                 

                So I set the create policy to "none" for my to navigation tab, but not working properly.

                 

                This is my structure:

                <s:Panel width="100%" height="100%" title="myTitle" >

                     <mx:Label x="10" y="12" text="Test"/>

                     <mx:ComboBox id="MyCombo" />

                     <mx:TabNavigator id="first_tn" top="40" width="100%" height="100%" creationPolicy="none">

                          <s:NavigatorContent id="A_nc"

                               <mx:TabNavigator id="First_A_tn"

                                    <s:TabNavigator >

                                    <s:TabNavigator >

                                    <s:TabNavigator >

                               </mx:TabNavigator>

                          </s:NavigatorContent>

                         <s:NavigatorContent id="B_nc"

                               <mx:TabNavigator id="First_B_tn"

                                    <s:TabNavigator >

                                    <s:TabNavigator >

                                    <s:TabNavigator >

                               </mx:TabNavigator>

                          </s:NavigatorContent>

                          <s:NavigatorContent id="C_nc"

                               <mx:TabNavigator id="First_C_tn"

                                    <s:TabNavigator >

                                    <s:TabNavigator >

                                    <s:TabNavigator >

                               </mx:TabNavigator>

                          </s:NavigatorContent>

                          <s:NavigatorContent id="D_nc"

                               <mx:TabNavigator id="First_D_tn"

                                    <s:TabNavigator >

                                    <s:TabNavigator >

                                    <s:TabNavigator >

                               </mx:TabNavigator>

                          </s:NavigatorContent>

                     </mx:TabNavigator>

                 

                Inside each s:TabNavigator I have an AdvancedDatagrid.

                I set creationPolicy="none" to the top label navigator first_tn. At first time only the comboBox is load with data, if user select an option I need to display all.

                I have an creationComplete="init()" function, inside this function I set first_tn.createDeferredContent() but still datagrids are not available.

                What else do I need to do? createDeferredContent doesn't convert availability for all the items that this container have?

                I am now confuse

                Thanks

                • 5. Re: Help with Profiler
                  Flex harUI Adobe Employee

                  Use the default creationpolicy, don’t set it anywhere.  If it is still creating 30, set a breakpoint on the constructor and examine the call stack to see why they are being created.

                  • 6. Re: Help with Profiler
                    jfb00 Level 3

                    I take out all creation policy, still showing 30.

                    How can I do a break point in the constructor?

                    When I run profiler, create a memory snapshot, I can see the 30 instances. If I click in ther the Object reference view show the list of 30.

                    Where can I see the reference of creation here?

                    Maybe I need to see a profiler tutorial

                    Thanks

                    • 7. Re: Help with Profiler
                      jfb00 Level 3

                      I checked couple examples and this is what i did.

                      I create a snapshot before and after calling the module in question.

                      Got to the object reference that I see the multiple datagrids ( I reduce this to only 3 because I was having hard time to load the app)

                      I see the next image, how can i go from here?

                      Thanks

                       

                      profiler01.JPG

                      • 8. Re: Help with Profiler
                        Flex harUI Adobe Employee

                        Open the source file for ADG, find the constructor, set a breakpoint, then debug the app and look at the call stack.

                        • 9. Re: Help with Profiler
                          jfb00 Level 3

                          Got it Alex, it was the parent having creation policy.

                          Now, It loads only one advanced datagrid. How can I make the others ADG available after the form loads?

                          When I select an option in the comboBox it starts getting data and trying to fill the datagrids but I got an error "Cannot access a property or method of a null object reference" because the datagrid is not available.

                          Thanks!

                          • 10. Re: Help with Profiler
                            Flex harUI Adobe Employee

                            You can call createDeferredContent(), but the recommended practice is to not push data down to the components.  They should pull the data from a data model when they are created.

                            • 11. Re: Help with Profiler
                              jfb00 Level 3

                              Ok, this mean that when user click on different tab the datagrid that is inside of that tab is created, correct?

                              Is so, how can I leasing to the tab click? or how can i know then the datagrid is created?

                              I need to find a trigger so I can fire a function that will set the data.

                              Thanks!

                              • 12. Re: Help with Profiler
                                Flex harUI Adobe Employee

                                There are various application frameworks designed to manage this for you.  Fundamentally, the idea is that there is a central model and on creationComplete of the DataGrid, it accesses the model and assigns its own dataprovider.

                                • 13. Re: Help with Profiler
                                  jfb00 Level 3

                                  Got it Alex, I will start looking into frameworks. My app use a lot datagrids with large data and calculations, use coldfusion cfc to talk with the database.

                                  What framework do you recommend? We don't have a large budget so it has to be something easy to learn.

                                  For now i am going to use the creationComplete event of the ADG.

                                  As always you are very helpful.

                                  Thanks!

                                  • 14. Re: Help with Profiler
                                    Flex harUI Adobe Employee

                                    I am application framework agnostic.  I’ve never used one.   I’ll probably get in trouble with the app framework folks, but IMHO, if you work for a company and they are only going to have one or two apps, I’d probably just use creationComplete.  If you are a consultant banging out similar apps for several clients, then there is advantage to learning one so you can assemble apps out of re-usable pieces.  App frameworks have a cost in performance and control over optimizations and are yet another thing to learn.