Speeding up app start time

J

Jm

Hi all

I know this might sound a little stupid but i thought id better ask anyway
in case there are some things i havent already tried that everybody else
knows. Basically i am wondering if there is any way to speed up the time it
takes for my app to display its first form. There is very little code before
the form loads, pretty much just a line or two to load the images on it but
it still can take quite a while on some machines to start up. Is this
standard with any app because .NET apps take that little bit more to get
going than vb6 ones did ? I have removed references that arent used in the
app to attempt to speed it up, is there anything else i should be looking at
? Any help is greatly appreciated

Thanks
 
P

Phill. W

Jm said:
i am wondering if there is any way to speed up the time it takes for
my app to display its first form.

There's a utility called ngen, that "pre-links" your assembly into a
"Native Image" that should load faster. I did this for some of my
applications and it /did/ make a difference - they loaded about 2%
faster. Not so good.

If you're running the application from a network share (as I am),
rather than from the loca file system, it takes the Framework a long
time to "find" adn load your assemblies. Try loading any shared
ones into the Global Assembly Cache on the local machine. Doing
/this/ gained me somewhere around a 40% improvement (production
application load time is now around 3-4 seconds).

If everything's running from the local file system, though, there's
probably not much that you can do - it really /does/ take a lot to
get a .Net program off the ground; use SysInternals Process
Explorer (or equivalent) and you'll see just how much "junk" each
one needs to load ... ;-)

HTH,
Phill W.
 
H

Herfried K. Wagner [MVP]

Jm said:
I know this might sound a little stupid but i thought id better ask anyway
in case there are some things i havent already tried that everybody else
knows. Basically i am wondering if there is any way to speed up the time
it
takes for my app to display its first form. There is very little code
before
the form loads, pretty much just a line or two to load the images on it
but
it still can take quite a while on some machines to start up. Is this
standard with any app because .NET apps take that little bit more to get
going than vb6 ones did ?

When a .NET application is loaded, the CLR and some huge libraries are
loaded. The JIT compiler will have to translate the MSIL to native code.
You can reduce application start time by creating a native image of the
application on the machine running the application by using "Ngen.exe".
This can be done as part of the application's installation process too.
 
J

jo0ls

Jm said:
Hi all

I know this might sound a little stupid but i thought id better ask anyway
in case there are some things i havent already tried that everybody else
knows. Basically i am wondering if there is any way to speed up the time it
takes for my app to display its first form. There is very little code before
the form loads, pretty much just a line or two to load the images on it but
it still can take quite a while on some machines to start up. Is this
standard with any app because .NET apps take that little bit more to get
going than vb6 ones did ? I have removed references that arent used in the
app to attempt to speed it up, is there anything else i should be looking at
? Any help is greatly appreciated

Thanks

..net languages compile into MSIL which is what is in your exe file. The
MSIL has to be compiled at run time into processor specific code. (JIT -
just in time compiling). The MSIL ges compiled as it is used and the
final processor specific code is stored in case it gets called again
when the program is running. Unfortunately this means that there is a
delay each time a component in your program gets used for the first
time, subsequent uses of the item during that program run will be much
quicker. Next time the app starts though it has to be compiled again
from MSIL...
You can do pre-JIT compiling so that the MSIL is compiled before run
time (usually done at install time), and so application start times are
improved. The downside of pre-JIT is that the JIT compiler will optimise
the code better. Look up ngen (native image generator) in the msdn for
help on doing this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top