Re: Compilation

From: Nick Cipollone [MSFT] (NickCip_at_online.microsoft.com)
Date: 03/29/04


Date: Sun, 28 Mar 2004 22:49:30 -0800

Hi Dave,

> I wrote a c# application (dll) and i use it in my project, but every time
i
> compile and run my project it take a long time to start running, i guss it
> becuse the jits compilers.
>
> How can i config my c# application that after i first compile it it will
not
> compile again in run time (on the same computer)???

If you are starting from the debugger there is always some amount of lag
before the project launches. This lag time increases the more assemblies
you reference. It gets dramatically longer (and debugging itself becomes
more sluggish) if you have unmanaged debugging turned on in the startup
project's properties. That should be off by default for a C# project and
you should generally only turn it on if you know you're going to need it.

If you're not talking about starting from the debugger but just about the
load time in general then perhaps you're noticing the time it takes to load
the .NET Framework when the first assembly is referenced. It's possible,
although somewhat unlikely, that it's the JIT compilation of your assembly
that is to blame, as you suggest above. While it's true that assemblies are
JIT compiled each time they are loaded, in most cases this overhead is not
noticeable.

If you want to experiment with pre-JIT compiling your assembly or some part
of it, then please read the documentation for the .NET Native Image
Generator (NGEN.EXE) in the .NET Framework SDK Documentation and see if it
is something that would make sense for you to use. While using NGen is an
option, few people find that they need it.

    Hope that helps,
        Nick Cipollone

--------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.



Relevant Pages

  • Re: Debugging Newbie Question
    ... The CLR does not understand this source code and so before it ... ASP.NET, however, ASP.NET will compile your page's source code and cache ... the debugger will have IL and x86 created from ... in release mode assemblies. ...
    (microsoft.public.dotnet.faqs)
  • Re: Debugging Newbie Question
    ... The CLR does not understand this source code and so before it ... ASP.NET will compile your page's source code and cache the result ... > does this so that a debugger can attach to the code and allow you to step ... > release mode assemblies. ...
    (microsoft.public.dotnet.faqs)
  • Re: asp.net assembly best practices question...
    ... > user control assemblies. ... > |> Thanks for your response Jojobar, ... you can find that the image or other resource files in the asp.net ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Carrying Libraries on Your Back...
    ... > Why not build on an installed based of assemblies, ... > than porting libraries around, ... download source code ... compile local source against header files ...
    (microsoft.public.dotnet.languages.vb)
  • Re: general strong name question
    ... You have a project that compiles to a dll. ... Each time you recompile this assembly, and attempt to run the other apps, ... When you compile an assembly, ... assemblies) into the config files of the applications that use the ...
    (microsoft.public.dotnet.general)

Loading