Alex Rivera | Logout

What is /optimize C# compiler key intended for?

Asked 2009-06-09T10:01:08.110
12

Is there a full list of optimizations done by the /optimize C# compiler key available anywhere?

EDIT: Why is it disabled by default? Is it worth using in a real-world app? -- it is disabled by default only in Debug configuration and Enabled in Release.

Edit
Report

1 Answer

2

It is disabled by default for debug builds. For Release builds it is enabled.

It is definitely worth enabling this switch as the compiler makes lots of tweaks and optimizations depending on the kind of code you have. For eg: Skipping redundant initializations, comparisons that never change etc.

Note: You might have some difficulty debugging if your turn on optimization as the code you have and the IL code that is generated may not match. This is the reason it is turned on only for Release builds.

answered 2009-06-09T10:08:40.980

Your Answer