my vector:
http://pastebin.com/5q7scy2k
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
LARGE_INTEGER t_start_counter, t_current_counter;
void tstart()
{
QueryPerformanceCounter(&t_start_counter);
}
double tend()
{
QueryPerformanceCounter(&t_current_counter);
double out;
out = (double)(t_current_counter.QuadPart - t_start_counter.QuadPart);
out *= 0.000001;
return out;
}
int main() {
int a = 0;
spvec<int> v;
vector<int> i;
double t1 = 0.0, t2 = 0.0;
tstart();
for (a = 0; a < 83886; a++) v.push(a + 100);
t1 = tend();
tstart();
for (a = 0; a < 83886; a++) i.push_back(a + 100);
t2 = tend();
cout << "times:" << t1 << "/" << t2 << " ration:" << t2 / t1 << endl;
return 0;
}
|
I think i have alot of learning to do before i start creating something at all.
results:
times:3.61922/0.003251 ration:0.00089826
I really need some help...
2 version, I'm just too stupid or i have to do some reading.
I read the code of default vector and now im trying to understand
everything what there is going on.
( its in progress right now ... still learning those new unknown stuff from there )
To be honest i don't understand what is going on there.
I thought that the only way of increasing dynamic array size is to
create new array with new size, copy old elements and delete old array and replace pointer but thats just horrible as my inside feeling told me.
Question to senior programmers.
Do i have hope to jump from this hopeless condition to condition where
i can actually do something what is better or same when it comes to
performance and effectiveness?
Any advice how i can improve myself?
( anything is welcome, even those big boring articles )
Perhaps my problem here is that im using really old methods.
I hope thats the case, it seems obvious.
( also please don't mind my re inventing wheel thing, i just really like to waste my time on that. )
Thank you.