C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Performance Question

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
BCC
Guest





PostPosted: Thu Feb 26, 2004 11:11 pm    Post subject: Performance Question Reply with quote



Why the 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 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
==========================

*/




Back to top
Jonathan Turkanis
Guest





PostPosted: Thu Feb 26, 2004 11:23 pm    Post subject: Re: Performance Question Reply with quote



"BCC" <bryan (AT) akanta (DOT) com> wrote

Quote:
Why the huge drop in performance in STL from VC6.0 to VC7.1?
Particularly
with vector?

The following code shows what I mean...

Here are my results:

VC7.1:

Total time taken for 1000x10000 int array operations: 0.062 seconds
Total time taken for 1000x10000 int vector operations: 0.094 seconds

VC6.5:

Total time taken for 1000x10000 int array operations: 0.062 seconds
Total time taken for 1000x10000 int vector operations: 0.235 seconds

Are you sure you have optimizations turned on?

Jonathan



Back to top
Andre Kostur
Guest





PostPosted: Thu Feb 26, 2004 11:24 pm    Post subject: Re: Performance Question Reply with quote



"BCC" <bryan (AT) akanta (DOT) com> wrote in
news:m2v%b.30906$Ql.1344 (AT) newssvr25 (DOT) news.prodigy.com:

Quote:
Why the 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 #include
using namespace std;

typedef vector
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 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
==========================

*/

Well... 2 things
1) This is compiler-specific, thus offtopic for comp.lang.c++
2) Were these compiled in "release" mode and not "debug" mode?

Back to top
BCC
Guest





PostPosted: Fri Feb 27, 2004 12:00 am    Post subject: Re: Performance Question Reply with quote


"Jonathan Turkanis" <technews (AT) kangaroologic (DOT) com> wrote

Quote:
"BCC" <bryan (AT) akanta (DOT) com> wrote in message
news:m2v%b.30906$Ql.1344 (AT) newssvr25 (DOT) news.prodigy.com...
Why the huge drop in performance in STL from VC6.0 to VC7.1?
Particularly
with vector?

The following code shows what I mean...

Here are my results:

VC7.1:

Total time taken for 1000x10000 int array operations: 0.062 seconds
Total time taken for 1000x10000 int vector operations: 0.094 seconds

VC6.5:

Total time taken for 1000x10000 int array operations: 0.062 seconds
Total time taken for 1000x10000 int vector operations: 0.235 seconds

Are you sure you have optimizations turned on?

Jonathan


I think so... are you sure you are using it's 7.1 and not 7.0? I fiddled
with the optimizations and nothing improved... for whatever reason, 7.0 is
faster than 7.1 when I tested it.

B



Back to top
Jonathan Turkanis
Guest





PostPosted: Fri Feb 27, 2004 12:07 am    Post subject: Re: Performance Question Reply with quote


"BCC" <bryan (AT) akanta (DOT) com> wrote


Quote:
I think so... are you sure you are using it's 7.1 and not 7.0? I
fiddled
with the optimizations and nothing improved... for whatever reason,
7.0 is
faster than 7.1 when I tested it.

Yes. I have all three, but VC7.0 is not working and needs to be
reinstalled.

As Andre pointed out, this thread is off topic. You can probably get a
good response at

microsoft.public.dotnet.languages.vc

People from Microsoft and Dinkumware read this group and often answer
questions like this.

Jonathan



Back to top
BCC
Guest





PostPosted: Fri Feb 27, 2004 12:17 am    Post subject: Re: Performance Question Reply with quote


Quote:

As Andre pointed out, this thread is off topic. You can probably get a
good response at

microsoft.public.dotnet.languages.vc

People from Microsoft and Dinkumware read this group and often answer
questions like this.


Right on. I actually posted a question earlier about where to ask this
question, but my post never showed up... go figure.

Ill take it over there, thanks.

B



Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.