Welcome to MSDN Blogs Sign in | Join | Help

Sara Ford's Weblog

My adventures embracing open source on CodePlex and at Microsoft

News

    • Did you know... All author proceeds go directly to sending Hurricane Katrina survivors to college.

      Microsoft Visual Studio Tips book

      Recent Entries

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: ,
Posted: Wednesday, August 13, 2008 3:00 AM by saraford

Comments

Felipe said:

How did you see that Modules window?

# August 13, 2008 7:00 AM

Geert D. said:

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

# August 13, 2008 8:15 AM

geert.diddens@remmicom.be said:

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

# August 13, 2008 9:09 AM

Dave Straley said:

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!

# August 13, 2008 12:07 PM

saraford said:

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!

# August 13, 2008 12:36 PM

geert.diddens@remmicom.be said:

Thnx for listening (and sorry for the 2 posts)

# August 14, 2008 6:34 AM

echostorm said:

The C# guys have no complaints.  Keep it up Sara. =oD

# August 14, 2008 7:30 AM
New Comments to this post are disabled
Page view tracker