efficiency question

Hi
I have one vector of size 4 (vector<int> vec(4);) that its elements were read from a sequential file.
I have a copy of vec that its name is vec2 (vector<int> vec2(vec);)
I was investigating in performance efficiency of operations operate on containers and I found a weird and interesting thing.
When calling a function for vec and vec2 100,000,000 times, it takes 2415 milliseconds for vec and just 986 milliseconds for vec2.
Why this happens??

closed account (o1vk4iN6)
Source code would be helpful as there simply might be a mistake.
Topic archived. No new replies allowed.