Hi,
I have been trying to tune my vc7 compiled applications to perform at the
same or (preferably) better speed of the same vc6 application. Both
versions of my code are compiled with optimization, but the vc7 is quite
slow in comparison to the vc6 one.
My timing test was rougly 71 seconds for vc6 and 103 seconds for vc7.
The total number of calculations was roughly 191 million for vc6 and 89
million for vc7 after 13 seconds of run time.
I'm a bit confused at the results. Shouldn't the two compilers be at
least comparable?
If it matters, I'm using Visual Studio .Net Enterprise Architect 2002.
I've provided the test code, compiler options, and linker options used for
both compilers.
Compiler options for vc6:
/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS"
/Fp"Release/VSTest.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c
Linker (vc6):
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
/nologo /subsystem:conso le /incremental:no /pdb:"Release/VSTest.pdb"
/machine:I386 /out:"Release/VSTest.exe"
Compiler options for vc7:
/O2 /Ob1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /EHsc /MT
/Yu"stdafx.h" /Fp".\Release/VSTest.pch" /Fo".\Release/" /Fd".\Release/"
/W3 /nologo /c /TP
Linker (vc7)
/OUT:".\Release/VSTest2b.exe" /INCREMENTAL:NO /NOLOGO
/PDB:".\Release/VSTest.pdb" /SUBSYSTEM:CONSO LE odbc32.lib
odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
uuid.lib odbc32.lib odbccp32.lib /MACHINE:I386
Test source code (console application):
// VSTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
// comment out the next line to perform a looping test.
#define __USETHREAD
#include "windows.h"
#include <math.h>
#include "stdio.h"
#include "string.h"
DWORD g_TotalCalculat ions = 0;
DWORD __stdcall TestThreadFunct ion(void *ptr)
{
int num = 0;
int numMinutes = 0;
while (1)
{
Sleep(1000);
num = g_TotalCalculat ions;
numMinutes++;
printf("%d seconds and %d calculations\n" , numMinutes, num);
}
}
int main(int argc, char* argv[])
{
int i = 0;
DWORD dwStart = GetTickCount();
srand(dwStart);
DWORD threadId = 0;
#ifdef __USETHREAD
// create a test thread
CreateThread(NU LL, 0, TestThreadFunct ion, 0, 0, &threadId);
while (1)
#else
// set up a large for loop
for (i=0; i<1000000; i++)
#endif
{
double percentDone = (double)i / 1000000.0 * 100.0;
#ifndef __USETHREAD
// if no thread is used, set up a smaller inner loop.
for (int j=0; j<1000; j++)
{
#endif
// regardless of the method (threaded or looping)
// perform some basic math tests.
double a = 0.0;
a = cos((double)(ra nd() % 360)) * sin((double)(ra nd() % 360));
a += ((double)(rand( ) % 6000) / ((double)(rand( ) % 3000) + 1));
#ifndef __USETHREAD
} // small inner for loop
#endif
// increment the total number of calculation passes
// this is printed out by the separate thread.
g_TotalCalculat ions++;
#ifndef __USETHREAD
// More or less the next lines just let the user know that
// something really is happening.
int b = (int)(percentDo ne * 10000.0);
if (!(b % 10000))
{
// this isn't always called the way that I'd like,
// but that's not the issue.
printf("complet ed... (%0.2f%%)\r", percentDone);
}
#endif
}
printf("\n\nCom pleted test in %d ms.\n", GetTickCount() - dwStart);
return 0;
}
--
Brian 7 2229
Can you try to force the /fp:fast compile flag and see what result you get?
Stephan
This compile flag isn't recognized by my compiler (cl version 13.00.9466).
cl : Command line warning D4002 : ignoring unknown option '/fp:fast'
The closest I can find is '/Fp', but that is used for specifying a
precompiled header. Is this something that I need to add as a pragma?
I've searched MSDN, but I'm not seeing this option. :(
Thanks,
Brian
Stephan Schaem <ss*****@seriou smagic.com> wrote: Can you try to force the /fp:fast compile flag and see what result you get?
Stephan
It is a new option for the Whidbey version that is under development.
Ronald Laeremans
Visual C++ team
<Brian> wrote in message news:vu******** ****@corp.super news.com... This compile flag isn't recognized by my compiler (cl version 13.00.9466). cl : Command line warning D4002 : ignoring unknown option '/fp:fast'
The closest I can find is '/Fp', but that is used for specifying a precompiled header. Is this something that I need to add as a pragma? I've searched MSDN, but I'm not seeing this option. :(
Thanks, Brian
Stephan Schaem <ss*****@seriou smagic.com> wrote: Can you try to force the /fp:fast compile flag and see what result you
get? Stephan
Hi Ronald,
Do you have any ideas/suggestions as to why there is such a discrepancy
between the run times? I'd hoped that maybe the newer compiler 13.10.3077
would have provided better results, but they're still not as good as VC6.
In fact, they aren't too far off from the 13.00.9466 version of the
compiler.
I'm trying to justify the upgrade to VS .Net to my managers, but unless I
can get similar if not superior results, they're going to just stick with
v6.
Thanks for your help,
Brian
Ronald Laeremans [MSFT] <ro*****@online .microsoft.com> wrote: It is a new option for the Whidbey version that is under development.
Ronald Laeremans Visual C++ team
<Brian> wrote in message news:vu******** ****@corp.super news.com... This compile flag isn't recognized by my compiler (cl version 13.00.9466). cl : Command line warning D4002 : ignoring unknown option '/fp:fast'
The closest I can find is '/Fp', but that is used for specifying a precompiled header. Is this something that I need to add as a pragma? I've searched MSDN, but I'm not seeing this option. :(
Thanks, Brian
Stephan Schaem <ss*****@seriou smagic.com> wrote: > Can you try to force the /fp:fast compile flag and see what result you get? > Stephan
It's all in the switches.... My tests, as it turns out, were not fair
tests. I had inadvertently left the compiler settings for use with
single-threaded runtime (/ML) in the release options for VC6 and
multithreaded runtime (/MT) in the release options for VC7
When I set them both to /MT, the results were what I'd expect them to be.
Brian Hi Ronald,
Do you have any ideas/suggestions as to why there is such a discrepancy between the run times? I'd hoped that maybe the newer compiler 13.10.3077 would have provided better results, but they're still not as good as VC6. In fact, they aren't too far off from the 13.00.9466 version of the compiler.
I'm trying to justify the upgrade to VS .Net to my managers, but unless I can get similar if not superior results, they're going to just stick with v6.
Thanks for your help, Brian
Ronald Laeremans [MSFT] <ro*****@online .microsoft.com> wrote: It is a new option for the Whidbey version that is under development.
Ronald Laeremans Visual C++ team
Brian wrote: It's all in the switches.... My tests, as it turns out, were not fair tests. I had inadvertently left the compiler settings for use with single-threaded runtime (/ML) in the release options for VC6 and multithreaded runtime (/MT) in the release options for VC7
When I set them both to /MT, the results were what I'd expect them to be.
The difference in performance is probably from the use of rand() in your
code. rand() maintains per-thread state when the multi-threaded runtime
library is used, while it's simply a global static variable when the single
threaded library is used.
-cd
Thanks Carl. Now that I think about it, that makes perfect sense. The difference in performance is probably from the use of rand() in your code. rand() maintains per-thread state when the multi-threaded runtime library is used, while it's simply a global static variable when the single threaded library is used.
-cd
--
Brian This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: brianlanning |
last post by:
I'm trying to write a function that can reliably know the name of the
calling method. I've figured out how to do this:
string methodname = (new StackTrace()).GetFrame(1).GetMethod().Name;
This seems to get the name of the method that called the current
method. But there are two problems. One is that I have to hardcode
one step back in the stack. When switching to a release build, this
may not work corerctly because of optimization....
|
by: Simon Harris |
last post by:
Hi All,
I've been told that VS.Net has two build options - debug and release. Can
anyone tell me how to uses these? Utp now, I've just build using the build
button.
Thanks,
Simon.
|
by: John C Kirk |
last post by:
I've come across an odd situation, where doing a floating point
division produces different results for the same numbers. Basically,
there are 4 ways to run this application:
A) Debug build, inside the IDE
B) Debug build, outside the IDE (e.g. launched from Explorer)
C) Release build, inside the IDE
D) Release build, outside the IDE
Using methods A-C produces one result, and using method D produces a
|
by: Sagaert Johan |
last post by:
Hi
Can a lot of Console.Writeline commands cause a program to run slower ?
johan
|
by: Philip |
last post by:
In VS.NET 2005, I have C# class library projects and when I switch to conduct
a release build ... the build still creates program debug files (PDB). I
have tried everything.... I have manually deleted all PDBs before conducting
the RELEASE build...
Any known issues with Release builds ?
Any options somewhere I am missing ?
--
| |
by: Andrew Rowley |
last post by:
I am having trouble getting debug and release builds to work properly
with project references using C++ .NET and Visual Studio 2003.
I created a test solution, with a basic Windows form C++ project.
I then add a class library, and add a reference to this project in the
first project.
When I do a release build, I see the following in the output from the
DLL compile:
/OUT:"C:\Documents and Settings\Andrew\My Documents\Visual Studio
|
by: Daniel |
last post by:
do release builds have the same amount of info in exceptions? e.g. will
exceptions cought in release builds contain stack trace etc.?
|
by: Duncan Smith |
last post by:
Last week, I got reports back of errors in a patch I let someone try
out (release dll, but not from the build machine). Turns out it was
some Debug::Assert statements firing.
In umanaged code, I'd always understood that assertions were only
fired in debug builds and would compile down to NOPs in release builds
(for good reasons)
Now it looks as though I have to be careful to code assertions
conditionally?
|
by: Andy B |
last post by:
How do you tell vs2005 to keep debug info out of your release builds? When I
build a release and a debug version, there seems to be no difference in them
at all...The release builds still have the debug databases with them...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |