In C # programming, to end-user programs that need to use Release configuration, and the Release configuration and debug configuration, there is a key difference is that release compiler optimizations are enabled by default.
The optimized code switch, the optimize switch, is combined with the debug switch in several combinations.
| Compiler Switch Settings | C#il Code Quality | JIT Native Code Quality |
| ------------- |:-------------:| -----:|
| /optimize-/debug-(default) | Not Optimized | With optimization |
| /optimize-/debug (+/full/pdbonly) | Not Optimized | Not Optimized |
| /optimize+/debug (-/+/full/pdbonly) | With optimization | With optimization |
?
When you create a new C # project in Visual Sutdio,
The debug of the project is configured with the/optimize-and/debug:full switches,
The Release configuration specifies the/optimize+ and/debug:pdbonly switches
optimize-/+ determines whether the compiler optimizes the code, optimize-is not optimized, but in general, there are some basic "optimization" work, whether or not specified optimize+, will be executed.
Optimize-and optimize+
This feature is primarily used for dynamic semantic analysis, which helps us to write code better.
- Constant calculation
- Simple branch Check
Optimize+ only
. NET JIT mechanism, the main optimization is done in the JIT, optimize do a bit of simple work.
Tools:
Visual Studio Community targeting. NET Core 2.0
IL DASM (vs comes with)
C # compiler optimizations that little thing