I opened up a large file of 700MB and read it in a vector<char> and then I want to insert in front of the file its size.
I turns out to be not only very slow but also max out the CPU.
Is it normal or am I doing something wrong?
It works well on smaller files though.
Code:char szDigits[32] = "700111222"; vector<char> v(filesize+260, '0'); // contains file for(int i = 0; i< 9; i++) // it gets very slow here { v.insert(v.begin()+i, szDigits[i]); cout << "i: " << i << endl; }