I need to push 66,000 vectors (the number of vectors is not fixed, it can be 90,000 vectors also. For the sake of brevity I am showing the below code with the example of 66,000 vectors) of type vector into the following vector:
vector<int> vec;
The size of each of the 66,000 vectors is 9,000 elements. I am using the following for doing the same:
vec.reserve(66000*9000);
for(int j=0;j<66000;j++)
for(int i=0;i<9000;i++) //9000 elements in vec1[i] per vector is not fixed
vec.push_back(vec1[i]); //i am pushing i as an example
Is there someway by which I may increase the efficiency of this code?
I need to concatenate too many vectors, so a solution for the same is potentially different from concatenating two vectors. Also I can not use multi-threading as mentioned in the previous question