473,545 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VC7.1 STL Performance Problem

BCC
I am noticing what seems to be a huge drop in performance in STL from VC6.0
to VC7.1. Particularly
with vector.

The following code shows what I mean...

Any thoughts?

Thanks,
B

//Test the speed of operations on primitive arrays and vectors
#pragma warning(disable : 4786)

#include <vector>
#include <time.h>
#include <iostream>

using namespace std;

typedef vector<int> IntVec;

int main(int argc, char* argv[])
{
clock_t start, finish;
start = clock();
const int dim1 = 1000;
const int dim2 = 10000;

int* matrix[dim1];
for(int i = 0; i < dim1; i++)
{
matrix[i] = new int[dim2];
for(int j = 0; j < dim2; j++)
matrix[i][j] = j;
}

finish = clock();
cout << "Total time taken for " << dim1 << "x" << dim2;
cout << " int array operations: ";
cout << double(finish-start) / CLOCKS_PER_SEC << " seconds" << endl;
for( i = 0; i < dim1; i++)
{
delete[] matrix[i];
}

start = clock();

vector<IntVec> intvecs(dim1);
for( i = 0; i < dim1; i++)
{
intvecs[i].resize(dim2);
for(int j = 0; j < dim2; j++)
intvecs[i][j] = j;
}

finish = clock();
cout << "Total time taken for " << dim1 << "x" << dim2;
cout << " int vector operations: ";
cout << double(finish-start) / CLOCKS_PER_SEC << " seconds" << endl;

return 0;
}

/**
*
=============== ===========

output from VC6.0:

Total time taken for 1000x10000 int array operations: 0.12 seconds
Total time taken for 1000x10000 int vector operations: 0.14 seconds

=============== ===========

output from VC7.1:

Total time taken for 1000x10000 int array operations: 0.12 seconds
Total time taken for 1000x10000 int vector operations: 1.231 seconds
=============== ===========

*/

Nov 17 '05 #1
6 1598
BCC <br***@akanta.c om> wrote:
I am noticing what seems to be a huge drop in performance in STL from VC6.0
to VC7.1. Particularly
with vector.

The following code shows what I mean...

Any thoughts?
I presume this is in release mode, with
optimizations applied?
Thanks,
B
[...]


Schobi

--
Sp******@gmx.de is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
Scott Meyers
Nov 17 '05 #2
BCC

"Hendrik Schober" <Sp******@gmx.d e> wrote in message
news:uc******** ******@TK2MSFTN GP10.phx.gbl...
BCC <br***@akanta.c om> wrote:
I am noticing what seems to be a huge drop in performance in STL from VC6.0 to VC7.1. Particularly
with vector.

The following code shows what I mean...

Any thoughts?


I presume this is in release mode, with
optimizations applied?
Thanks,
B
[...]


Schobi


Yes.
Nov 17 '05 #3
BCC wrote:
"Hendrik Schober" <Sp******@gmx.d e> wrote in message
I presume this is in release mode, with
optimizations applied?


Yes.


Are you sure? I compiled your code with VC7.1 and got the following
results:

R:\>cl -O1 -EHs vectperf0227.cp p
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

vectperf0227.cp p
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.

/out:vectperf022 7.exe
vectperf0227.ob j

R:\>vectperf022 7
Total time taken for 1000x10000 int array operations: 0.093 seconds
Total time taken for 1000x10000 int vector operations: 0.094 seconds

R:\>

-cd


Nov 17 '05 #4
BCC wrote:
"Hendrik Schober" <Sp******@gmx.d e> wrote in message
I presume this is in release mode, with
optimizations applied?


Yes.


You're not using Visual C++ .NET 2003 Standard Edition, are you? If so - no
optimizer, which would explain the performance difference.

-cd
Nov 17 '05 #5
BCC

"Carl Daniel [VC++ MVP]" <cp************ *************** **@mvps.org.nos pam>
wrote in message news:Oo******** *****@TK2MSFTNG P11.phx.gbl...
BCC wrote:
"Hendrik Schober" <Sp******@gmx.d e> wrote in message
I presume this is in release mode, with
optimizations applied?
Yes.


You're not using Visual C++ .NET 2003 Standard Edition, are you? If so -

no optimizer, which would explain the performance difference.

-cd


Yikes! We are using that version. Nobody knew that this version has no
optimization available. Why the heck would microsoft do that? Well, I
guess $$ is the usual answer...

Thanks for the tip..

B
Nov 17 '05 #6
"BCC" <br***@akanta.c om> wrote in message
news:8A******** *********@newss vr27.news.prodi gy.com...

Yikes! We are using that version. Nobody knew that this version has no
optimization available. Why the heck would microsoft do that? Well, I
guess $$ is the usual answer...


See http://msdn.microsoft.com/visualc/ho.../choosing.aspx

-cd
Nov 17 '05 #7

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

Similar topics

5
1721
by: Steve_CA | last post by:
Hello all, I've been recruited to assist in diagnosing and fixing a performance problem on an application we have running on SQL Server 7. The application itself is third party software, so we can't get at the source code. It's a Client Management system, where consultants all over the country track their client meetings, results, action...
0
1177
by: Andrew Mayo | last post by:
This problem was discovered with MSDE2000 SP2 and under WinXP SP2. We are unsure whether it is more widespread as it has only been seen on one machine to date. The problem is related to name resolution. If you attempt to connect to a local database with a connect string using server=. rather than
6
2310
by: teedilo | last post by:
We have an application with a SQL Server 2000 back end that is fairly database intensive -- lots of fairly frequent queries, inserts, updates -- the gamut. The application does not make use of performance hogs like cursors, but I know there are lots of ways the application could be made more efficient database-wise. The server code is...
4
3353
by: Martin | last post by:
I am using graphics as backgrounds for forms,buttons,labels etc. The question is: is it faster to load all graphics from files on app start or to use it embeded (places in editor during design). Reason for my question is that application has 5mb, while without graphics it has cca 400kb. Graphic files (bmps) take about 200kb (in program, they...
13
2732
by: bjarne | last post by:
Willy Denoyette wrote; > ... it > was not the intention of StrousTrup to the achieve the level of efficiency > of C when he invented C++, ... Ahmmm. It was my aim to match the performance of C and I achieved that aim very early on. See, for example "The Design and Evolution of C++". -- Bjarne Stroustrup;...
13
4104
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make sense to punch out from managed code to native code (I was using IJW) in order to do some amount of floating point work and, if so, what that certain...
17
2035
by: 57R4N63R | last post by:
I'm currently building a website for one of the client. There has been few errors here and there, but just recently the problem is getting worse. Basically the symptoms is that when the user try to access the page, it takes really long time to load. However, after up to 1 hour, the website will run fine again as normal. This issue has...
8
1865
by: NAdir | last post by:
Hi, thank you for your help. My VB.Net application contains a document that the user can refresh at any time. The refresh works fine and needs to loop through few datatables (hundreds of rows). This works fine until I delete some rows in two tables. Just after the delete if I do the refresh there is a huge memory allocated and the time...
1
2442
by: jvn | last post by:
I am experiencing a particular problem with performance counters. I have created a set of classes, that uses System.Diagnostics.PerformanceCounter to increment custom performance counters (using .Net 2.0) The performance counter categories have been successfully created. When the set of classes are used by a WinForm test harness application,...
30
3478
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
0
7393
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7653
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, 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. ...
0
7803
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7411
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...
0
5965
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5322
isladogs
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...
0
4942
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...
0
3444
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
695
bsmnconsultancy
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...

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.