Does the debugger slow programs down?

  • Thread starter Thread starter Michael A. Covington
  • Start date Start date
M

Michael A. Covington

How much slower does a program run in the debugger (Visual Studio) (with no
breakpoints set) than by itself?
 
Only when its being used or while its set to true in web.config. How much?
Depends on system memory perhaps a couple seconds.
 
Michael A. Covington said:
How much slower does a program run in the debugger (Visual Studio) (with
no breakpoints set) than by itself?

As is almost always the case with such questions; it depends!

The main difference is that an application to which a debugger is attached
it typically compiled with debug options. Importantly this suppress the
normal optimisations a compiler would otherwise make when compiling for
release.

If the application spends most of its time in libraries then very little
difference will be seen. OTH if the application spends most of its time in
its own code that would normally be optimised it could make quite a
significant difference. There is no easy way to tell.
 
Michael said:
How much slower does a program run in the debugger (Visual Studio) (with
no breakpoints set) than by itself?

That depends on what the program does.

All compilation optimization is off, so there is a little more code to
run for most operations. That will slow it down a few percent.

Throwing exceptions in debug mode costs a lot more than in release mode.
If you do this a lot (which of course is not recommended for normal
program flow), the code will get very slow.

The garbage collector changes how it determines when objects are unused
in debug mode. All variables are considered to be used throughout
their scope, so objects live longer causing a bigger memory footprint
for the application.
 
Back
Top