Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Speed difference between Ctrl+F5 and F5?

14 views
Skip to first unread message

Rose W

unread,
Apr 7, 2003, 5:12:37 AM4/7/03
to
Hi,

I have a program built under DEBUG configuration in VC++ 6.0. If I run
the exe file by pressing F5 in the IDE, the excution is very slow,
while if I run by pressing Ctrl+F5 (or run the exe file from explorer
by double-clicking), the excution is several times faster. I want to
know what has caused this difference in speed of the two running mode,
for the two are running the same exe file.

Thanks!

Rose

Rich Dutton

unread,
Apr 7, 2003, 4:22:10 PM4/7/03
to
When you F5 you start the process running under the debugger. This means
that the debugger gets notified everytime something of interest occurs
(thread start, exception, dll load, etc.) which probably imposes a large
overhead. In addition, a process started under a debugger will use the debug
OS heap which features lots of extra checking, and is bound to be loads
slower as a result.
If this is a problem then you may find WinDbg to impose a smaller
performance overhead but, unless it's really causing problems, you should
just accept it. Nothing for free, and all that.

"Rose W" <en...@sina.com> wrote in message
news:b42753ab.03040...@posting.google.com...

Rose W

unread,
Apr 8, 2003, 1:23:40 AM4/8/03
to
Thanks for your explanations, Rich. I still have a few questions:

If I press Ctrl+F5 to run the program or run it standalone, I can also
attach the running program to VC debugger later. After being attached
to the debugger,
the program's running speed does not change much. That is to say, it
is still running at a speed much faster than the speed of directly
pressing F5 to run the program. Is this speed difference mainly caused
by the debug heap? I guess the overhead of the debugger environment in
the two circumstances won't differ much. When the program is running
standalone, is it using a different heap from that of the F5 funning?
Is it possible to configure the debugger to behave the same way for F5
running and running standalone with attaching to debugger later?


"Rich Dutton" <nottu...@NOSPAMhotmail.com> wrote in message news:<e130ec663842089d...@news.teranews.com>...

Rich Dutton

unread,
Apr 8, 2003, 7:03:52 PM4/8/03
to
I think that, yes, the speed difference is mainly caused by the debug heap.
The heap is checking every allocated block each time you call one of its
functions so the overhead is high.
When running stand-alone debug heap checking is not enabled.
Someone else may know better, but it's my belief that this checking cannot
be turned off when running under the debugger. IMHO it's ace anyway, I'd
need a really good reason to think about turning it off.

"Rose W" <en...@sina.com> wrote in message
news:b42753ab.03040...@posting.google.com...

Pavel Lebedinsky

unread,
Apr 8, 2003, 7:38:13 PM4/8/03
to
This is from windbg docs:

<quote>
Instead of using the standard heap API, processes created by
the debugger use a special debug heap. On Windows XP and
Windows Server 2003, you can force a spawned process to
use the standard heap instead of the debug heap by using the
_NO_DEBUG_HEAP environment variable or the -hd
command-line option.
</quote>

Obviously, -hd only works in windbg/cdb/ntsd, but _NO_DEBUG_HEAP
should work even if you use VC debugger.

Rose W

unread,
Apr 9, 2003, 2:31:51 AM4/9/03
to
Thanks! I want to know whether the _NO_DEBUG_HEAP environment variable
(is this a system environment variable like the "PATH"?) is supported
by Windows 2000 server?

"Pavel Lebedinsky" <m_pll at hotmail dot com> wrote in message news:<3e935d65$1...@news.microsoft.com>...

0 new messages