Condividi tramite


Did you know… How to optimize your code for a build? - #290

in yesterday’s tip, i explained what is and isn’t your code.

One of the ways to make your code not yours (okay, it’s technically non-user code, i’m having way too much fun on this play on words) is to optimize it.

For C#, go to the Project Properties – Build page.

Optimize code option for C#

For VB, go to the Project Properties – Compile. At the bottom of the page, there’s the “advanced compile options” button. Pressing this button will show you the option to optimize your code.

Optimize code option for VB

Once again, I get the luxury of having the “email the developer” feature whenever an option doesn’t work for me.  After 20 minutes of trying to figure out why my code was still acting like my code, I emailed the developer, and found out that you need to make sure one checkbox is unchecked.

Under Tools – Options – Debugging – General, there’s the Suppress JIT optimization on module load (Managed only)

Suppress JIT optimization on module load

With the optimized code option checked and the Suppress JIT optimization on module load unchecked, you’ll see the ClassLibrary1 (from yesterday’s example) now optimized and no longer your code (non-user code)

ClassLibrary1 in Modules window

Technorati Tags: VS2005Tip,VS2008Tip

Comments

  • Anonymous
    August 12, 2008
    PingBack from http://housesfunnywallpaper.cn/?p=513

  • Anonymous
    August 12, 2008
    How did you see that Modules window?

  • Anonymous
    August 13, 2008
    Hi Sara, Love your tips...but, being a programmer from the wrong side of the language fence (i.e being a VB.NET dev), I have a tip for you : is it possible to indicate it when a tip is C# only? (In VB.NET there's no Build page, only a Compile page...on the checkboxes you mention are not on it ;( Greetz Geert

  • Anonymous
    August 13, 2008
    Did you know… that some of your tips are C# only, and that can be confusing for a VB.NET dev.  (There's no Build page, only a Compile page...and other options) Maybe you could indicate that (or give a "workaround" when appropriate ?) PS: Did you know… I do love you tips ! Greetz

  • Anonymous
    August 13, 2008
    Do you have any idea what the performance ramifications are (in general?) for these 2 different scenarios - i.e. optimized-without-JIT-optimization, vs. the default scenario? Thanks for the detective work in snooping this out!

  • Anonymous
    August 13, 2008
    Sorry for the VB / C# confusion.  i'm obvously out of my IDE expertise with these debugging tips. I'll try to do a sanity check for variations between the two languages moving forward. Thanks for letting me know and thanks for reading!

  • Anonymous
    August 13, 2008
    Thnx for listening (and sorry for the 2 posts)

  • Anonymous
    August 13, 2008
    The C# guys have no complaints.  Keep it up Sara. =oD