C # compiler optimizations that little thing

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.