Execution speed difference when debugging C# app

I'm posting this on behalf of a colleague.  He wrote a Genetic Algorithm with a graphical display using VS 2005 RTM.  He recently upgraded from VS 2005 Beta 2.

The execution speed when running a release build from the IDE using F5 is significantly slower versus running it with Ctrl-F5.  (I have reproduced this on my machine).

He claims that the speed differential didn't exist under Beta 2 of Visual Studio 2005.

Here's a set of rough numbers I gathered from casual benchmarking.  First column is the build type, second column is how it was executed from the IDE, and third column is seconds to complete execution.

debug f5 43
debug ctrl-f5 14
release f5 40
release ctrl-f5 12

Does anyone have any ideas whats causing the 40 vs 12 second difference   Remember that magnitude difference did not occur under Beta 2.  There are no breakpoints.

Thanks,

Brian



Answer this question

Execution speed difference when debugging C# app

  • i2adnan

     Miha Markic wrote:

    Perhaps, but why would you run release version in debug mode Why don't you just hit Ctrl-F5

    It is a nuisance, not in that you have to use an extra keypress, but rather in that you get an unexpected and dramatic impact in performance.  "Disconcerting" is a better word.  Also I'm not advocating that running Release builds with F5 needs to be fast.  I'm simply probing for why it's so slow. 

    And your blog link sure looks like the culprit.  I'll pass it on. 

    Many thanks, Miha!

    Brian


  • JaredK

    Just curious, why does it matter

    And debugger has to do something otherwise it would seem as useless :-)



  • anuppm

    True, the impact isn't significant, but it is a nuisance.  Also, the debugger is not "doing something": it should be idle until some exception is trapped.

    Since this is a cpu-intensive program, you would want Release builds to run fast, and running it with F5 shouldn't differ than Ctrl-F5.  These numbers show a dramatic slowdown, which wouldn't occur if it were a C++ project.

    The intention of this post to understand why this is occuring, not to be unblocked from working.  My colleague is taking performance extremely seriously--using CodeDOM to compile GA fitness functions for instance--and it is a let down that this behavior starting occuring after he upgraded from Beta 2 to RTM.

    Brian

     


  • Ashwin Jayamohan

    Hi Brian,

    "True, the impact isn't significant, but it is a nuisance. "

    Perhaps, but why would you run release version in debug mode Why don't you just hit Ctrl-F5

    "Also, the debugger is not "doing something": it should be idle until some exception is trapped."

    I remember that debugger is doing more than that and it has some performance problems when managed code is doing interop. See this blog post:

    http://blogs.msdn.com/jmstall/archive/2006/01/17/pinvoke_100x_slower.aspx



  • Execution speed difference when debugging C# app