|
From: Ben Voigt [C++ MVP] on 6 Jul 2008 21:35 "Jon Skeet [C# MVP]" <skeet(a)pobox.com> wrote in message news:MPG.22b241bbc4f93330d41(a)msnews.microsoft.com... > Daniel <Mahonri(a)cableone.net> wrote: >> What is the difference in definition between clr and jit compiler? > > The JIT compiler is just one small part of the CLR. > >> Does the use of jit make .NET an interpreted language, or is it still >> a compiled language, or both? > > The code is never interpreted in .NET - always JIT compiled and then > executed natively (with support from the CLR, of course). Which occasionally is a performance-killing mistake. For example, a type initializer. Is there ever an advantage to optimizing the .cctor? Anything I can think of that could need optimization (anonymous methods, expression trees, etc) has already been separated by the compiler before any MSIL is generated. > > -- > Jon Skeet - <skeet(a)pobox.com> > Web site: http://www.pobox.com/~skeet > Blog: http://www.msmvps.com/jon.skeet > C# in Depth: http://csharpindepth.com
From: Andrei Varanovich [C# MVP] on 7 Jul 2008 00:10 Hello Ben, >> The code is never interpreted in .NET - always JIT compiled and then >> executed natively (with support from the CLR, of course). >> > Which occasionally is a performance-killing mistake. > For example, a type initializer. Is there ever an advantage to > optimizing the .cctor? Anything I can think of that could need > optimization (anonymous methods, expression trees, etc) has already > been separated by the compiler before any MSIL is generated. If you care about performance -- use NGEN utility from .NET SDK. It produces native code from your assebmly instead of IL. Thanks, Andrei
From: Jon Skeet [C# MVP] on 7 Jul 2008 14:24 Ben Voigt [C++ MVP] <rbv(a)nospam.nospam> wrote: > >> Does the use of jit make .NET an interpreted language, or is it still > >> a compiled language, or both? > > > > The code is never interpreted in .NET - always JIT compiled and then > > executed natively (with support from the CLR, of course). > > Which occasionally is a performance-killing mistake. > > For example, a type initializer. Is there ever an advantage to optimizing > the .cctor? Anything I can think of that could need optimization (anonymous > methods, expression trees, etc) has already been separated by the compiler > before any MSIL is generated. Likewise the initialization code for most forms is often executed only once. I believe that Sun's HotSpot JIT will interpret code the first time it runs, unless it spots significant loops. The benefit of the "always JIT, and JIT exactly once" solution is that it's much simpler than the kind of optimisation HotSpot performs. But yes, there can be a price to pay. -- Jon Skeet - <skeet(a)pobox.com> Web site: http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon_skeet C# in Depth: http://csharpindepth.com
|
Pages: 1 Prev: Excel does not die using automation Next: Convert Formatted Double Into String |