473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Start Without Debugging(CTRL F5) 3x slower than Start With Debugging(F5)!

This one has me at whit's end.

In order for this to make sense, I will have to lay out the "facts" to
get a hypothesis. There is no easy way to explain this.

Environment: VC2005. MFC Application. Native only.

I compile and link the App.

If I hit CTRL-F5....results 700 ms. (does not recompile or relink)
If I double click in debug folder..700 ms. (does not recompile or
relink)
If I hit F5 (Start With Debugging)...result 200 ms. (does not recompile
or relink)

Profiling the code shows that a computationally expensive function
takes 3 times as long if NOT being debugged. Oddly, a function thats
being called from a DLL takes the same amount of time in both
instances. In other words, it is not a uniform slowdown of the App.
So what are some differences between CTRL-F5 and F5?

Working directory for one.

So to make SURE that both are using the same sets of DLLs, I copy all
the DLL's that the debugger loads(shown in output window) into a
temporary directory, and place my app there.

I run the app. Still 700 MS.

What other differences are there between attaching the debugger and NOT
attaching the debugger that could cause this kind of slowdown????

Feb 17 '06 #1
9 3218
Additional Detail:

I have found that the culprit is the _DEBUG preprocessor directive.

As I understand it, _DEBUG causes things to be handled differently at
the CRT level...

Is this perhaps a data alignment issue? I don't want to be
distributing debug builds....

lo***********@yahoo.com wrote:
This one has me at whit's end.

In order for this to make sense, I will have to lay out the "facts" to
get a hypothesis. There is no easy way to explain this.

Environment: VC2005. MFC Application. Native only.

I compile and link the App.

If I hit CTRL-F5....results 700 ms. (does not recompile or relink)
If I double click in debug folder..700 ms. (does not recompile or
relink)
If I hit F5 (Start With Debugging)...result 200 ms. (does not recompile
or relink)

Profiling the code shows that a computationally expensive function
takes 3 times as long if NOT being debugged. Oddly, a function thats
being called from a DLL takes the same amount of time in both
instances. In other words, it is not a uniform slowdown of the App.
So what are some differences between CTRL-F5 and F5?

Working directory for one.

So to make SURE that both are using the same sets of DLLs, I copy all
the DLL's that the debugger loads(shown in output window) into a
temporary directory, and place my app there.

I run the app. Still 700 MS.

What other differences are there between attaching the debugger and NOT
attaching the debugger that could cause this kind of slowdown????


Feb 17 '06 #2
lo***********@yahoo.com wrote:
Additional Detail:

I have found that the culprit is the _DEBUG preprocessor directive.

As I understand it, _DEBUG causes things to be handled differently at
the CRT level...

Is this perhaps a data alignment issue? I don't want to be
distributing debug builds....

lo***********@yahoo.com wrote:
This one has me at whit's end.

In order for this to make sense, I will have to lay out the "facts" to
get a hypothesis. There is no easy way to explain this.

Environment: VC2005. MFC Application. Native only.

I compile and link the App.

If I hit CTRL-F5....results 700 ms. (does not recompile or relink)
If I double click in debug folder..700 ms. (does not recompile or
relink)
If I hit F5 (Start With Debugging)...result 200 ms. (does not recompile
or relink)

Profiling the code shows that a computationally expensive function
takes 3 times as long if NOT being debugged. Oddly, a function thats
being called from a DLL takes the same amount of time in both
instances. In other words, it is not a uniform slowdown of the App.
So what are some differences between CTRL-F5 and F5?

Working directory for one.

So to make SURE that both are using the same sets of DLLs, I copy all
the DLL's that the debugger loads(shown in output window) into a
temporary directory, and place my app there.

I run the app. Still 700 MS.

What other differences are there between attaching the debugger and NOT
attaching the debugger that could cause this kind of slowdown????


lostnewmexico:

I think you are confusing running under the debugger (versus not) with
debug build versus release build.

In debug build, _DEBUG is always defined, regardless of whether you are
running under the debugger.

In release build, _DEBUG is not defined, and you normally do not run
under the debugger (though you can).

I think you are telling us about speeds of the debug build, with and
without the debugger attached. What you say does surprise me, but
ulimately all that matters is the speed of the release build. I would
hope that it would be faster than the debug build (with or without the
debugger).

David Wilkinson
Feb 17 '06 #3
Thanks for the response David,

I'm not confusing the two...the issues seem to be intertwined.

Check this out:

With _DEBUG defined:

200 MS with or without Debugger attached.

With NDEBUG defined:

200 MS with Debugger attached.
700 MS without Debugger attached.

Feb 17 '06 #4
Thanks for the response David,

I'm not confusing the two...the issues seem to be intertwined.

Check this out:

With _DEBUG defined:

200 MS with or without Debugger attached.

With NDEBUG defined:

200 MS with Debugger attached.
700 MS without Debugger attached.

Feb 17 '06 #5
> Is this perhaps a data alignment issue? I don't want to be
distributing debug builds....

one thing with debug builds: they are built by default to enable buffer
overload detection and extra runtime checking.
For example, if you corrupt your stack in debug build, you get debugger
output messages saying so. I've seen this a few times.
This implies (at least i think it does) that during your program execution,
there is a lot of stuff going on in the background.

when you are ready to release your application, change the configuration to
release. rebuild, and ship the output of the release configuration.
the release configuration will always be faster than the debug builds.
because it will be optimized, and not do all of the debugging stuff.

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"
Feb 18 '06 #6
lo***********@yahoo.com wrote:
Thanks for the response David,

I'm not confusing the two...the issues seem to be intertwined.

Check this out:

With _DEBUG defined:

200 MS with or without Debugger attached.

With NDEBUG defined:

200 MS with Debugger attached.
700 MS without Debugger attached.


Well, there is more difference between debug and release builds than
just _DEBUG and NDEBUG. Optimization level, library versions ... Are
you creating a true release build?

David Wilkinson

Feb 18 '06 #7

David Wilkinson wrote:
lo***********@yahoo.com wrote:
Thanks for the response David,

I'm not confusing the two...the issues seem to be intertwined.

Check this out:

With _DEBUG defined:

200 MS with or without Debugger attached.

With NDEBUG defined:

200 MS with Debugger attached.
700 MS without Debugger attached.


Well, there is more difference between debug and release builds than
just _DEBUG and NDEBUG. Optimization level, library versions ... Are
you creating a true release build?

David Wilkinson


Thats true David, but the only thing I am changing is the _DEBUG to
NDEBUG for this...Essentially, I delted my Release configuration, made
a new Release configuration out of Debug, then flipped things until
this problem reoccured.

The ONLY thing that is different is the _DEBUG to NDEBUG change.

So I guess I need to find out the exact differences between the two.

Feb 18 '06 #8
> Essentially, I delted my Release configuration, made
a new Release configuration out of Debug,


I don't think NDEBUG vs. DEBUG is making the diference. My guess is that you
have some debug build options(s) set in both the release and debug builds. It
could be that the symbol file loads faster or is preloaded when running in
the debugger but is simply unused overhead when not using the debugger.

To really prove it out - try a true release build (e.g. no symbol
generation, optimize for speed, etc.) and then compare that to running under
the debugger vs. outside the debugger.
--
Greg McPherran
www.McPherran.com
Feb 19 '06 #9
In case this could possibly help someone else, I found the problem.

For some reason, when you divide a float by 0, this takes a lot more
time under release than debug to generate or deal with the quiet NAN's.

I

Feb 22 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Noam Raphael | last post by:
Hello, Many times I find myself asking for a slice of a specific length, and writing something like l. This happens both in interactive use and when writing Python programs, where I have to write...
0
by: Dean | last post by:
This is a problem in ASP.NET, when I run an application from Visual Studio (2003) when I do a "start without debugging". The asp page uses objects that I have built in 3 other projects,...
0
by: The Last Danish Pastry | last post by:
A couple of days ago there was a thread "Returning the machine epsilon". The responses in that thread suggested using Double.Epsilon or Single.Epsilon. Since both these seem to return zero I...
6
by: mg | last post by:
The following .exe and its parameters work correctly from the command prompt (it prints x.pdf without prompting the user. acrord32.exe /t "c:\exportfiles\x.pdf" "HP LaserJet 3300 Series PCL 6"...
0
by: Lucas Tam | last post by:
Hello, I'm trying to launch a Windows Form Remoting Server which listens on port 54321 using Process.Start. Process.Start launches the application correctly, but I can't seem to connect to...
1
by: Nick Ward | last post by:
Hey, I'm writing an app using C# visual studio express edition. When i run it in debug mode it runs fine and works perfectly, but when i run it without debugging (or from explorer) it crashes and...
3
by: AnalogKid17 | last post by:
I have the following line of code in my start/login page: document.getElementById("txtLogin").focus(); When I run the website app through F5 (Debug, Start Debugging) it works fine (ie, focus...
6
by: Bob Rock | last post by:
Hello, I'm using an executable (for which I do not have the source code nor the pdb file) as the startup application to load a DLL I'm writing and need to debug. If I try to debug the DLL I...
1
markmcgookin
by: markmcgookin | last post by:
Hi Folks, this is a problem I had a few days ago, and I was able to solve it, but I thought I'd post the solution I found here incase anyone has a similar problem! I found this stuff on an MSNDN...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.