#include <iostream>
#include <vector>
#include <windows.h>
#include <time.h>
using namespace std;
int main()
{
LARGE_INTEGER frequency;
LARGE_INTEGER t1, t2;
double elapsedTime;
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&t1);
vector< vector<int> > ith (750,35);
//vector <int> ich (750);
QueryPerformanceCounter(&t2);
elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
cout << elapsedTime << " ms.\n";
cin.get();
return 0;
}
and if the size needs to be increased i use
ith[i][j]=0; // how i store values ith.resize (ith.size()+1, vector<int>(ith[0].size(),0)); ich.resize (ich.size()+1);
Is it better to not declare a size and use push_back ? i checked this roughly and you have to declare two additional vectors and assign thier values to the multidimensional one but this is even more time consuming
How do i optmimize my code ?
This post has been edited by cppdeveloper: 18 October 2011 - 10:18 AM

New Topic/Question
Reply



MultiQuote




|