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); } } ================================== _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio