-
January 7th, 2012, 03:57 AM
#1
The strange performance of Visual C++ application
I compiled a quite large C++ project in Visual Studio 2010 Ultimate using the Intel Composer compiler 2011, DirectX SDK (June 2010) and Intel TBB. After starting (either the Release or Debug assembly) directly from within Visual studio in debug mode (by pressing F5) the project runs much faster than when it started the outside of Visual studio (starting the .exe file directly).
Application type - event simulation of molecular dynamics. In general, even visually, i can see how the motion of particles (about 100 000 molecules) is much slower when you run the exe-file directly. Priority class for the application process is HIGH_PRIORITY_CLASS, work-threads of applications (responsible for the processing of events) have priority THREAD_PRIORITY_HIGHEST. As a result, when the application runs from the visual-studio (via F5) work threads are faster than running via Ctrl+F5 or exe-file directly
User - ADMINISTRATOR
What could cause this and how can it be fixed?
C++ compiler is configured for X86:
Platform: Win32
Target machine: MachineX86 (/MACHINE:X86)
My PC:
Processor - Mobile DualCore AMD Turion X2 Ultra ZM-80, 2100 MHz (5.25 x 400)
RAM - DDR2 4GB
Video - ATI Mobility Radeon HD 3650 (M86) 512MB
OS - Windows 7 Ultimate 64-bit
P.S. I'm sorry for my English - I'm from Russia
-
January 8th, 2012, 05:17 AM
#2
Re: The strange performance of Visual C++ application
I suggest profiling your application to see where the difference comes from. VS2010 has special tools for profiling, but I've never used them. You can find tutorials online.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
-
January 8th, 2012, 06:27 AM
#3
Re: The strange performance of Visual C++ application
Originally Posted by Kofan
... when the application runs from the visual-studio (via F5) work threads are faster than running via Ctrl+F5 or exe-file directly
User - ADMINISTRATOR
What could cause this and how can it be fixed?
...
Did you compare the Release or Debug builds?
Last edited by VictorN; January 8th, 2012 at 06:42 AM.
Victor Nijegorodov
-
January 8th, 2012, 11:42 AM
#4
Re: The strange performance of Visual C++ application
I compared the results for the Release version, because I disabled the optimization in the debug version. In my case Debug version is only for debugging the program and it runs slowly.
The main problem consist in the fact that when I run the Release Version from the Visual Studio via F5 (with binding debugger), it works much faster than if I run application via Ctrl+F5 (without binding debugger) or exe-file directly.
I would be very grateful for any help.
-
January 8th, 2012, 12:44 PM
#5
Re: The strange performance of Visual C++ application
what happens when you set a normal priority class and level for your worker threads ? maybe, you're just experiencing some priority inversion ...
-
January 8th, 2012, 01:36 PM
#6
Re: The strange performance of Visual C++ application
The number of threads equal to the number of processor-cores. By setting a high priority threads - all cores busy my application and CPU load at 100%. If the thread priorities are normal CPU load only 50-60% because in fact some kernel idle, and the program runs very slowly.
-
January 8th, 2012, 05:00 PM
#7
Re: The strange performance of Visual C++ application
Hopefully with the threads set to highest priority in your application, you don't plan on running any other application.
-
January 9th, 2012, 03:28 AM
#8
Re: The strange performance of Visual C++ application
Originally Posted by Kofan
The number of threads equal to the number of processor-cores. By setting a high priority threads - all cores busy my application and CPU load at 100%. If the thread priorities are normal CPU load only 50-60% because in fact some kernel idle, and the program runs very slowly.
my question was: do you see the same with/without debugger behavior when using normal priorities ? I ask, because if high priority threads share resources with lower priority threads then this may result in a worse overall performance due to the former excessively waiting for the latter ( aka priority inversion ) ...
for example, in post #1 you alluded to "visually" seeing the slowdown of your program, so, do you have a set of (high priority) worker threads and a (normal priority) gui thread visualizing the data ? if yes, does the total number of threads (workers+gui) equal the avaliable cores ? are you sure the slowdown isn't just due to the gui becoming unresponsive (and/or the workers sharing data with it) ?
-
January 11th, 2012, 10:51 AM
#9
Re: The strange performance of Visual C++ application
Originally Posted by Kofan
The number of threads equal to the number of processor-cores. By setting a high priority threads - all cores busy my application and CPU load at 100%. If the thread priorities are normal CPU load only 50-60% because in fact some kernel idle, and the program runs very slowly.
This doesn’t make much sense.
You are saying that your threads (with normal priorities) are NOT utilizing CPU at 100%? What are they waiting for if no one else is using that CPU?
It sounds like you don’t have enough threads running simultaneously.
For example, if I create a busy thread doing something like
and if some processor core is available, it will use 100% of that core whatever it’s priority is – right?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
January 9th, 2012, 12:08 AM
#10
Re: The strange performance of Visual C++ application
If it says Microsoft on the box, there is sure to be trouble inside . . .
-
January 9th, 2012, 10:48 AM
#11
Re: The strange performance of Visual C++ application
Originally Posted by He_That_Is
If it says Microsoft on the box, there is sure to be trouble inside . . .
"If you can't say something nice, don't say nothing at all"
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
January 12th, 2012, 11:29 AM
#12
Re: The strange performance of Visual C++ application
Originally Posted by Kofan
within Visual studio in debug mode (by pressing F5) the project runs much faster than when it started the outside of Visual studio (starting the .exe file directly).
Well to me, it would be unexpected that an application running under a debugger (or any integrated environment) would run at the same speed as running straight from the command prompt or from Windows Explorer.
The debugger has to load symbols, output messages to the VS output window, etc. It would be natural to suspect that running under a debugger should add some overhead somewhere.
Read this:
http://blogs.msdn.com/b/larryosterma...heisenbug.aspx
Maybe that explains your issue?
Regards,
Paul McKenzie
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|