Click here to Skip to main content
15,893,368 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
I choose an cosoleapplication as project type with c# as language .When i built the program it creates the.exe file in bin/debug folder.
Now my question is that:
Is this .exe now used by jit to produce native code?
Posted
Comments
Sergey Alexandrovich Kryukov 26-Oct-12 12:29pm    
"Console application"? Excuse me, are you on such a big rush? If so, you hardly can get any benefits even if you get help.
And don't you thing that it would be much more effective just to read on the topic?
--SA

1 solution

Basically, yes, but it has nothing to do with "debug" or "release" folders. Folders are totally irrelevant, they are only options of different build configurations and can be absolutely anything. But even configurations are irrelevant; they are just the sets of building options which you can change and create your own configurations, with debug information or not. And finally, even those options, including debug information, are totally irrelevant. Keep reading.

In fact, every executable you produce in pure .NET assembly goes through JIT. (By "executable" here I mean executable module of any assembly; there are no difference if this is EXE, DLL or anything else — this is just a part of a file name making no difference at all; the central notions of .NET code is module and assembly, but Visual Studio only supports creation of assemblies each composed of only one module.) All pure-.NET assemblies are obtained by compilation of source code to CLI bytecode, called CIL (Common Intermediate Language, a.k.a. MSIL) in .CLI, which is finally translated to CPU instructions during runtime.

[EDIT]

The note on pure .NET is not redundant. It's possible to create mixed-mode executable modules combining native (unmanaged) and managed code. Notably, such modules can be created using C++/CLI (at the moment of writing, I'm unfamiliar with other tools capable of this kind of development). Apparently, only managed part of code is subject of JIT compilation.

Please see:
http://en.wikipedia.org/wiki/C%2B%2B/CLI[^],
http://www.ecma-international.org/publications/standards/Ecma-372.htm[^],
http://msdn.microsoft.com/en-us/library/xey702bw.aspx[^].

[END EDIT]

Please see my comments to the question and don't rush. It's not so simple. Usually, it happens on per-method basis, before a moment of time when a method is about to be called for the very first time.

Please see:
http://en.wikipedia.org/wiki/JIT-compilation[^],
http://en.wikipedia.org/wiki/Common_Intermediate_Language[^],
http://en.wikipedia.org/wiki/Common_Language_Infrastructure[^],
http://msdn.microsoft.com/en-us/library/k5532s8a.aspx[^].

The last link is to the Microsoft article explaining steps of compilation the code to MSIL, MSIL to native code, and its execution.

—SA
 
Share this answer
 
v4
Comments
BillW33 26-Oct-12 14:45pm    
An execellent, informative answer, for a simplistic question. +5
Sergey Alexandrovich Kryukov 26-Oct-12 15:10pm    
Thank you very much.
The question is simplistic, but the topic is not that simple. It's good to understand. CodeProject practice shows that many do incorrect performance measurements, without taking off the JIT time from the equation; others over-estimate problems related to JIT.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900