Reputation: 1320
My application has several large forms with lots of images which dramatically increases the size of the built executable. Over time, it seems that the startup performance becomes sluggish and it doesn't seem to be getting any better.
If I put all of the forms besides the main form in a separate dll, would it alleviate some of the pressure put on the application during startup?
I'd test it myself, but I have A LOT of forms and I don't want to do it unless someone can confirm that such an action will prove to be useful.
Upvotes: 2
Views: 395
Reputation: 40649
As others said, profile, don't guess.
Not just any profiler will do. Here's a user (besides me) who discovered random pausing on his own. You say the "intense" methods are all in dlls you don't have source code for - that's typical and normal. What you need to know is which statements in your code are requesting the time to be spent, and they can't be restricted to CPU-only time. Most profilers don't tell you this, but random-pausing does.
If you're interested, here's a recent discussion of the issues.
Upvotes: 0
Reputation: 19871
I'm wondering if you were to use MEF and Lazy load, then when you actually need the module (Form) instantiate by calling .Value.
There are a couple of things I do with applications containing a lot of forms:
Are the images actually included in the .dll? If so, I would actually put my images into a .dll separate from the UI.
Given that the images are for toolbars, I wouldn't split them out as resources. I'll still stand fast on my advice to split into multiple .dlls.
Upvotes: 0
Reputation: 44181
Another tip that may be useful: This reduced my application's startup time from 2 minutes to <10 seconds on a low-end thin client. Use NGEN to generate a precompiled native image of your assemblies.
Upvotes: 1
Reputation: 6719
Many factors can affect startup performance. Have you used any tools to prove that it's the images?
For a start, go through these tips: http://devcomponents.com/blog/?p=361
And consider using multithreading to load bigger objects in the background.
Upvotes: 1
Reputation: 8269
I'm not quite sure about that, but if I were you I would use the Profiler when it comes to improving performance.
Before I go guessing what's wrong, I consult with it and work my way up, because it tells me which methods and classes are costing the most in my code.
Upvotes: 1