The Moth
Developer, Former MVP, now at Microsoft - Best of
2004
,
2005
,
2006
,
2007
,
2008
,
2009
« Internet Explorer 8 using Restart APIs t...
|
Home
|
Best source code comments »
Measuring performance under Visual Studio
Mon, April 6, 2009, 07:58 PM under
dotNET
When I created my Visual Studio C#
demos for showing off Tasks versus Threads
, I of course created the project in Release mode, but there were 2 additional things that I had to do.
One had little impact, but is important to remember: set the power plan on Windows to "High Performance". Otherwise CPU usage can be throttled by the OS, which is not what you want when you are demonstrating parallelism and 100% CPU usage
The other had a profound impact and had me puzzled for a bit: use Ctrl+F5 instead of F5. The difference in the time the threads scenario took was humongous. That is because the naïve threads demo creates around 1023 threads and it turns out creating threads under the debugger (F5 case, even in release mode) is measurably slower than not. I should have known that, but I didn't, so sharing it here in case you didn't either: when measuring perf, always use Ctrl+F5 in release mode.
For a lot more on the performance difference between running under the debugger and not, I recommend Joc's blog post:
Why is my app so much slower under the debugger
.
Comments [3]
|
Permalink
Tuesday, April 07, 2009 8:44:00 AM (Pacific Daylight Time, UTC-07:00)
Hey Daniel just noticed you've touched the perf thing :)
Yonks ago, Vance Morrison implemented his Code Timers for perf measurement: http://blogs.msdn.com/vancem/archive/2006/09/21/765648.aspx
It's great as it incorporates the basic statistics, all those mean/median/standard deviation things that give you a much richer understanding of a measurement.
(And you can see how they work in real code: Mocking Frameworks Compare project uses it - see Performance Comparison at http://code.google.com/p/mocking-frameworks-compare/source/browse/trunk/Tests/CS/Performance/Program.cs)
Andrew
Thursday, April 09, 2009 5:02:00 AM (Pacific Daylight Time, UTC-07:00)
Daniel,
That reminds me of the difference of behaviour in the GC between debug and release modes that Jeffrey Ritcher mentions in his CLR via C# book.
http://stupiddumbguy.blogspot.com/2008/05/net-garbage-collection-behavior-for.html discusses it in more detail for those that don't have access to the book.
Daniel did you ever buy/read that book- I remember lending you the first edition way back in 2002? :-)
Richard OD
Saturday, May 09, 2009 1:45:57 PM (Pacific Daylight Time, UTC-07:00)
Andrew
: thanks for sharing
Richard
: Yes I read it… wow, that was a long time ago :-)
Daniel Moth
All comments require the approval of the site owner before being displayed.
OpenID
Please login with either your
OpenID
above, or your details below.
Name
E-mail
Home page
Remember Me
Comment (HTML not allowed)
Enter the code shown (prevents robots):
Live Comment Preview
About
My team's page on MSDN
Subscribe
Contact Form
My screencasts on channel9
Tags
AboutPresenting (5)
Blogging (7)
Career (5)
Communication (5)
dotNET (120)
Events (93)
GPGPU (2)
HPC (6)
IE7 RSS (6)
Links (129)
LINQ (23)
MobileAndEmbedded (148)
Orcas (128)
ParallelComputing (63)
Personal (32)
Random (42)
SideShow (12)
Silverlight (17)
SoftwareProcess (3)
UAC (14)
UserInterfaceDesign (5)
Vista (84)
VisualStudio (112)
Whidbey (31)
Windows (90)
WindowsServer2008 (3)
Latest Posts
Parallel Computing Platform Developer Lab
Slides and code for MPI Cluster Debugger
DirectCompute
GPGPU
Code for Parallelism Features Tour
Managed code and the Shell – Do?
Dev Lead Job opening on my team
Best of "The Moth" 2009
Bug Triage
Parallel Computing Features Tour in VS2010
MPI Cluster Debugger launch integration in VS2010
Parallel Debugging
"Parallel Programming Talk" show
Message Passing Interface (MPI)
Windows HPC Server links
Extension Manager in Visual Studio 2010
Core debugger enhancements in VS2010
Dump debugging with Parallel Stacks
Slides for Parallel Debugging windows
MPI Project Template for VS2010
Archives
March, 2010 (2)
February, 2010 (3)
January, 2010 (3)
December, 2009 (1)
November, 2009 (11)
October, 2009 (12)
September, 2009 (1)
August, 2009 (6)
July, 2009 (5)
June, 2009 (3)
May, 2009 (7)
April, 2009 (5)
March, 2009 (3)
February, 2009 (4)
January, 2009 (6)
December, 2008 (3)
November, 2008 (12)
October, 2008 (6)
September, 2008 (9)
August, 2008 (5)
July, 2008 (5)
June, 2008 (8)
May, 2008 (18)
April, 2008 (11)
March, 2008 (13)
February, 2008 (17)
January, 2008 (15)
December, 2007 (20)
November, 2007 (25)
October, 2007 (19)
September, 2007 (11)
August, 2007 (31)
July, 2007 (24)
June, 2007 (19)
May, 2007 (24)
April, 2007 (18)
March, 2007 (35)
February, 2007 (34)
January, 2007 (17)
December, 2006 (18)
November, 2006 (17)
October, 2006 (23)
September, 2006 (22)
August, 2006 (15)
July, 2006 (15)
June, 2006 (13)
May, 2006 (10)
April, 2006 (5)
March, 2006 (1)
February, 2006 (1)
January, 2006 (2)
December, 2005 (5)
November, 2005 (4)
October, 2005 (3)
September, 2005 (8)
August, 2005 (17)
July, 2005 (11)
June, 2005 (7)
May, 2005 (24)
April, 2005 (15)
March, 2005 (15)
February, 2005 (18)
January, 2005 (23)
December, 2004 (24)
November, 2004 (25)
October, 2004 (10)
September, 2004 (23)
August, 2004 (12)
July, 2004 (1)