Taking vector size() out of loop condition to optimize
<p>fibs is a std::vector. Using g++, I was advised to take fibs.size() out of the loop, to save computing it each time (because the vector could change)</p>

<pre><code>int sum = 0;
for(int i = 0; i &lt; fibs.size(); ++i){
    if(fibs[i] % 2 == 0){
        sum += fibs[i];
    }
}
</code></pre>

<p>Surely there is some dataflow analysis in the compiler that would tell us that fibs won't change size. Is there? Or should I set some other variable to be fibs.size() and use that in the loop condition?</p>
