Monday, March 30, 2015

What optimizations does the C# compiler perform when you use the /optimize+ compiler option?

Question:What optimizations does the C# compiler perform when you use the /optimize+ compiler option??

Answer: </P><P align=justify>The following is a response from a developer on the C# compiler team: </P><P align=justify>We get rid of unused locals (i.e., locals that are never read, even if assigned).</P><P align=justify>We get rid of unreachable code.</P><P align=justify>We get rid of try-catch w/ an empty try.</P><P align=justify>We get rid of try-finally w/ an empty try (convert to normal code...).</P><P align=justify>We get rid of try-finally w/ an empty finally (convert to normal code...).</P><P align=justify>We optimize branches over branches: </P><P align=justify>gotoif A, lab1</P><P align=justify>goto lab2:</P><P align=justify>lab1:</P><P align=justify></P><P align=justify>turns into: gotoif !A, lab2</P><P align=justify>lab1:</P><P align=justify></P><P align=justify>We optimize branches to ret, branches to next instruction, and branches to branches.

Tags:Interview Questions, Microsoft, C#,

Please submit your Interview Answer for the above Question via replying to this post. Thank you for visiting to our blog, Have a Good Day!.



Sponsor Advertisement



Bulk SMS Sending Software

SMS Management System Software

This software used to Send bulk SMS (short text messages) from your computer and assists you to rapidly connect with your customers and staff, communicate with them easily and cheaply, using latest technology that help to generate bulk SMS on just one click to all the database....

No comments:

Post a Comment