Decreased performance when compiling with no options…

One of the things that we've done in Whidbey is add some extra IL instructions to improve the debugging experience. This allows you to (for example) set a break on a closing brace.

Because /o- is the default setting, this means that performance if you just compile with “csc” will be slightly degraded in Whidbey. If you've been building without setting /o+ and you care about perf, you will want to change your code to throw /o+ explicitly.

If you're using VS release and debug configurations, this will be set automatically for you.


Comments (12)

  1. Jim Arnold says:

    I get the feeling that’s going to usher in a whole raft of unfavourable Java-C# benchmarks 🙂

    But if this is for debugging, why not just set /o- implicitly if the /debug flag is set, and leave /o+ for release builds?


  2. If you aren’t running under the debugger, are there any IL instructions generated that the JITter can’t optimize away?

  3. Which new IL opcodes are these?

  4. Mattias Sjgren says:

    Mike: I think they are just nop instructions. So the opcodes aren’t new, but the fact that the compiler emits them is.

  5. Doug Thews says:

    I agree with Jum. Why not just set the /o+ option when you set the Release build option?

  6. Doug Thews says:

    Sorry, meant the /debug flag, and not the Release option under Configuration Manager.

  7. Eric Gunnerson blogs about. Apparently, nop instructions are now inserted in BOTH VB.NET and C# to allow breakpoints to be set on End Sub or braces lines. Adding the /o+ compiler option removes these statements, providing better code performance. Someone…

Skip to main content