bpurcell.org - Analyzing Application Startup Time in Flex
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    

Subject Archives
Amazon EC2 (15)
ColdFusionMX (155)
Corvette (3)
Flash Lite (4)
Flash Media Server (5)
Flash Player (3)
Flex (39)
General Web Dev (14)
HDTV (3)
Jboss (1)
Jquery (2)
JRun (59)
Max 2003 (3)
Other (33)
PC Hardware (16)
Software (17)
SpatialKey (7)
Wireless (8)
Working Out (1)

RSS Feed
Feed Listing

Site Contents
My Blog
Wireless & Networking
Hardware & Gadgets
Software Picks
Contact Me

My Articles & Papers
Flex Performance
mm.com Under the Hood
Multiple Instances of CFMX
Multiple Instance Config
NLB with ColdFusion
Clustering CFMX for J2EE
Multi-Tier Hardware LB w CFMX
Cisco CSS & Coldfusion MX
JRun 4 Jini based Clustering
WiFi Growth

2ID Tacweb

Other Hobbys
Body-For-Life Challenge

Personal Projects
Family Pool
Deck Gate


Viewing Individual Entry / Main
June 1, 2004

There are three factors that affect overall startup time: compilation time, download time, and application initialization time. Since compilation time only affects the first request and downloaded content is cached after the first request the application initialization time affects the users experience most of all. There are a few simple steps you can take to analyze the initialization time and target the areas that are affecting performance most.

With a few lines of code you can see the amount of time it takes to initialize your application.

  1. First you will need to add a Label component in some unobtrusive area of your application. In this example we will call it "initLbl"
    <mx:Label id="timerLbl"/>
  2. Add the following attribute to your Application tag: creationComplete="doLater(this, 'updateLabel')"
    <mx:Application ... creationComplete="doLater(this, 'updateLabel')">
  3. Add the following function to your Application script:
    function updateLabel
    timerLbl.text = getTimer();
    } ]]>

  4. Run your Flex application. The label should display the number of milliseconds that elapse during application startup. Run twice more to get an average.
  5. Now you can start to gradually remove pieces of your application, until you've whittled it down to nothing. Each time that you remove a piece, run the app (three times) and record the startup time. Due to dependencies in your code you may not be able to remove the pieces entirely. You can wrap your code snippets with the following code to prevent it from initializing when the application starts.
    <mx:Canvas creationPolicy="none">...tag(s) to be removed...</mx:Canvas>

After identifying code that is causing the problem you can use the recommendations in the performance developer center article to reduce the intitialization time of your application. You can also use the Flex Profiler to do more in depth analysis but the above approach provides developers a simple way to profile their application. Thanks to David George from Flex Engineering for providing the steps.


There are no comments on this entry.

Page Render Time:219