|
-
November 19th, 2016, 04:43 PM
#1
vector with same size running very slow than dynamically allocated array Edit topic
I have an array and vector both of same size and dimension. My code needs set operation to be performed on one of them. Now as i see, in vector their are set operation functions already present, but not for array. Since my array/vector is very big, using array for set operation is slow i think, so i want to use vector, but i dont know why when i run vector with same size program executes very slow. As i found that their is no need of dynamically allocating vectors. So what should i do now? My array is like:
Code:
#define sp1(m, n, o) (array1[dim2 * dim3 * m + dim3 * n + o])
int * array1 = (int *)malloc(dim1 * dim2 * sizeof(int));
And my vector with fixed size is like:
Code:
vector<vector<vector<int> > > p(dim1, vector<vector<int> >(dim1, vector <int>(dim2, dim3)));
So now how do i make the this vector run faster so than after that i can do set_intersection operation on them easily?
Last edited by 2kaud; November 20th, 2016 at 05:58 AM.
Reason: code tags added
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|