Share via


NETCF: Improve Startup Performances

"My NETCF application takes long to start, on both devices and emulators... is there any way to optimize this loading time? ".

Questions like that are arisen by mobile developers from time to time, so similarly to the post about power-efficiency, I have a sort of ready set of suggestions about how to possibly reduce startup time of a NETCF application. In any case, you should be aware that, even if you can use techniques to reduce the startup time, it may be that it won't be able to take less than "a few" seconds, and this is due to the intrinsic nature of the JIT-compilation of the .NET code (JIT = Just In Time). This is something true in general for .NET programming, not simply to the NETCF. And, apart from this, "performance" is a subjective matter, so at design-time be careful on understanding how long your users will accept to "wait" for your main form to appear and start using the app.

1- Above all, verify if targeting NETCF v3.5 can reduce startup time: even if v3.5 in general is faster than v2.0, it might be that the performances wouldn't be enough appreciated in your case. To run the v2 application on the v3.5 you don't need to re-compile the application by using VS2008 – you can instead use the approach I mentioned in one of my previous posts.

2- There's a 3RD party tool that I must mention regarding profiling an application. This is not Microsoft's code, therefore we don't offer support about it - in any case I've heard many developers using it with success: EQATEC Profiler.

3- Because of the JIT-compilation, reducing the startup time may be very difficult. Do you think you may launch the application at device startup and maintain it in background, so that when the user taps on its icon it gains focus and gives the impression of being loaded "immediately"? Yes, this approach would waste a process-slot in the virtual memory, nevertheless it grants you the desired performances when launching the application, so it may be something worth thinking about.

Some links:

  • The article Developing Well Performing .NET Compact Framework Applications reaches the following conclusions: "[…] A. Reduce the number of method and property calls on controls during startup. For example, Controls.Bounds is a better option than calls to Control.Location and Control.Size. -- B. Create the form from the top down. In nested control hierarchies, set the parent property of containers (using the above rule) before adding controls to the container. As in the BigForm application, the panels had their parent property set to the form before the 40 controls were connected to the panel. If further containers exist lower in the hierarchy, the same changes should be applied. ")
  • If you want to measure performances, you can read Performance and Diagnostics. Specifically, you should read How to: Improve Performance.
  • Finally, this is a quite old article but still applicable for some extents: Optimize Your Pocket PC Development with the .NET Compact Framework.

4- Since at the end of the day we're talking about *user's perceptions*, a broadly used way to "distract" the user while loading the initial form of your application is to use a Splash form. This is so useful that many resources are available on the topic:

 

Cheers,

~raffaele

Comments