tags:

views:

381

answers:

3

I have a VS2005/c# ClickOnce application that gets all its data from a Web Service. I've gotten the app tuned where it feels pretty snappy to the users, even though it has to go and fetch data from the web service for almost everything.

However, the startup is still pretty sluggish. It seems like it takes a while to generate the first web service call. After that, it's fine.

What can I do to speed up the startup of this type of an app? Do I need to generate a serialization assembly?

+4  A: 

Spend some time analyzing the assemblies loaded by your application. That's going to have the greatest affect (effect?...hmm always forget that one) on the load time of your application. If you have types that are only used on occasion, move them to another assembly. ClickOnce can optimize the download of assemblies on demand so reducing the required number of assemblies at load time will make it load faster.

You can also have a sort of "stub" launcher with bare minimum assembly dependencies that loads the other assemblies dynamically (Assembly.Load) and invokes the real processing after they are loaded.

Paul Alexander
(irrelevant) it's effect. affect is an active verb or, in psychology jargon, a noun denoting capability of expression of mood - but that sense puts the stress on the first syllable.
DDaviesBrackett
I'd like to hear more about the deferred loading/stub...
Tim
+2  A: 

You can use ClickOnce file groups to split your app into manageable pieces and then use the ClickOnce API to download groups when needed. Here's an article explaining how to do this.

Peter Lillevold
+1  A: 

Make sure you get .NET 3.5 SP1 as there are significant performance improvements in the area of startup. Particularly with WPF applications.

And as for the web service call, you can speed that up if you make sure you generate a serialization assembly when you compile. From what I can remember, Visual Studio is not very smart about knowing when to generate this file automatically but you can do it with SGEN.EXE.

It create a separate assembly such as MyApp.XmlSerializer.dll which contains all the serialization code for the web service call. Without this, your app will do a failed probe for the assembly then dynamically generate the code and compile it in-memory which is why your first web service call is slow.

Josh Einstein