[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed
From: |
Achilleas Anastasopoulos |
Subject: |
Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed |
Date: |
Sun, 14 May 2006 09:40:16 -0400 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
I run the following simple test, compiled with
g++ test.cc -o test
and I got the following results.
I see a 4-fold speed reduction using STL.
What am I doing wrong?
Achilleas
---------------------------
$ time ./test 10000 1
real 0m0.121s
user 0m0.120s
sys 0m0.001s
while
$ time ./test 10000 2
real 0m0.462s
user 0m0.459s
sys 0m0.003s
and
$ time ./test 100000 1
real 0m1.185s
user 0m1.184s
sys 0m0.001s
while
$ time ./test 100000 2
real 0m4.597s
user 0m4.595s
sys 0m0.002s
--------------------------
test.cc=================================
#include<vector>
int main(int ac,char **av) {
const int M = 1000;
std::vector<int> y(M);
int *x;
x=(int*)malloc(M*sizeof(int));
int N=atoi(av[1]);
if(atoi(av[2])==1) {
for (int i=0;i<N;i++)
for(int j=0;j<M;j++)
x[j]=i/(j+1);
} else if(atoi(av[2])==2) {
for (int i=0;i<N;i++)
for(int j=0;j<M;j++)
y[j]=i/(j+1);
}
}
==================================
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, (continued)
- Message not available
- Message not available
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Achilleas Anastasopoulos, 2006/05/12
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Ilia Mirkin, 2006/05/12
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Achilleas Anastasopoulos, 2006/05/12
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Ilia Mirkin, 2006/05/12
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, al davis, 2006/05/12
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Ilia Mirkin, 2006/05/12
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, John Aldridge, 2006/05/13
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Achilleas Anastasopoulos, 2006/05/12
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Eric Blossom, 2006/05/13
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed,
Achilleas Anastasopoulos <=
- Message not available
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Achilleas Anastasopoulos, 2006/05/14
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Eric Blossom, 2006/05/14
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Eric Blossom, 2006/05/14
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Dave Dodge, 2006/05/15
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, al davis, 2006/05/12
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, al davis, 2006/05/12
- Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Eric Blossom, 2006/05/13
Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Eric Blossom, 2006/05/13
Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Achilleas Anastasopoulos, 2006/05/13
Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed, Achilleas Anastasopoulos, 2006/05/13