Skip to main content
Inspiring
September 29, 2017
Question

Desktop app slow start time

  • September 29, 2017
  • 2 replies
  • 3073 views

Time between clicking desktop shortcut and showing first screen of my app is around 5-20 seconds. On fast computer it takes 5 seconds, but on slower ones it's around 20 seconds.

Interface is made of some .swf objects, but the .swf files take around 500kb altogether. I also check sqlite database version but this is just couple of select statements, so it shouldn't take too long.

At startup app is reading one local file and decrypt it. When I disabled this feature the startup time on slower computers is around 10 seconds. It's better but still I need to load this file before showing first screen.

I wonder if there is any way to speed up this process. Or if there is any way to check what is taking so long. In windows task manager I see that during startup app is working hard taking 30% of processor. Then it goes down to 1% after first screen is visible.

Air version: 2.7

Windows 10 (and windows 7 on slower computer)

Flash Builder 4.6

This topic has been closed for replies.

2 replies

Inspiring
October 17, 2017

"on slower ones it's around 20 seconds"

what is the hardware spec of those slower computers ?

sometimes people assume too much


you could also modify MXMLC to output your components on multiple frames instead of 1 frame

see "$ mxmlc -frame=0,Frame1Class -frame=1,Frame2Class -frame=2,Frame3Class"

Adobe Flex 4.6 * About the application compiler options

IbarimAuthor
Inspiring
October 18, 2017

It was intel core 2 duo. But as I said, startup of my app is much faster when I moved rendering of most of the interface to a later stage, after login of user. Now on slower computer it is about 5-7 seconds.

As for output on multiple frames , I'll read about it.

Inspiring
October 4, 2017

Here use this code (put this into a package of your choice):

package angrybot.flash.utils

{

  import flash.utils.getTimer;

  public class RuntimeSpeed

  {

  static private var initialTime:uint;

  [inline]

  static public function start():void

  {

  initialTime = getTimer();

  }

  [inline]

  static public function stop():void

  {

  if(initialTime == 0)

  {

  initialTime = getTimer();

  }

  var currentTime:Number = (getTimer() - initialTime) / 1000;

  trace("RuntimeSpeed stopped at: " + currentTime.toString() + " Seconds.");

  }

  [inline]

  static public function check(caption:String = null):void

  {

  if(initialTime == 0)

  {

  initialTime = getTimer();

  }

  var currentTime:Number = (getTimer() - initialTime) / 1000;

  var output:String = '';

  if(caption)

  {

  output = caption

  }

  output += " . Check at: " + currentTime.toString() + " Seconds."

  trace(output);

  }

  }

}

Simply call RuntimeSpeed.start() when your app starts then call RuntimeSpeed.check("your optional message here") anytime you want within your code. What it does is show you how much time has passed between each call to check() using this you can track down what code/line of code is taking time to execute. Instead of using trace you can even write to a local file. Anyway using this it's easy to see the timeframe of everything going on in your code. In my experience on some system SQLite access can be really slow for some reason.

IbarimAuthor
Inspiring
October 6, 2017

Thanks, it's very helpfull. I found out that sqlite and other stuff at startup sequence works quite fast. Problem must elsewhere.

I started your RuntimeSpeed class on application preinitilize() event. On a fast computer my app starts in around 6 seconds. With slow computer time is as follows:

1. Time from click on icon to showing application on screen is (on average) 12 seconds.

2. Time from preinitilize() to application creationComplete() event is around 4,3 seconds.

3. Time from creationComplete() event to my last startup function is around 1,2 seconds. During this time I do following things:

- read sqlite

- decrypt a file

- read shared objects

- and load some sound files

So first slow thing is 4,3 seconds from preinitlize() to creationComplete(). I don't know if it's normal time. For me it's too slow. Where does it come from? The only thing I can think of is that I have a lot of controls in my app, and all of them are on the stage from the begining. All of them must be craeted during this period of 4,3 s.

Second slow thing must be between click on app icon and preinitilize() event. 4,3 seconds + 1,2 seconds = 5,5 seconds. Since whole start time is around 12 seconds it gives 12 - 5,5 = 6,5 seconds between click on icon and preinitilize() event. I don't know what is happening during this time. I was trying to use Adobe Scout to check it out, but it doesn't give me enough information. Scout is for Actionscript projects only, my Flex project just shows general data. I attach a picture to show Scout output. As you can see at the beginnign frames go off the chart, it's like 0,2 frames per second. Also garbage collector running at the beggining is suspicious.

Inspiring
October 10, 2017

I would create an empty project and compare the start times with it, like that you would have a clear idea about how many seconds you are really losing with your project. I don't do much Flex projects but it would make sense they are slower to start since the entire Flex framework has a lot to do before rendering the first screen. You could try to make also an empty actionscript project (no Flex) to see if those are running faster at start. The Scout data is interesting, compare that with your empty projects. If at the end it's the Flex framework that is slow there might be ways to speed it up (mainly forcing it to render directly your first screen) but we'll see about that.