title: How to code fastest for loop ? vectors, iterators, basic ? what is the best method?
body: <p>Before I wasn't considering any speed issue during 3D graphics programming, but now I have to consider it seriously for real-time applications. In real-time, as well as offline I have to use a lots of loops, I used to write algorithms with basic for loop like this..</p>
  
  <pre><code>for (i=0; i&lt;nb; i++){}
  </code></pre>
  
  <p>So when I rum my algorithm with above for loop well you can also consider nested loops too, I have to wait for 5-10 seconds to finish it, but when I see any professional software they have much faster way for the same algorithm, just in eye blink time the algorithm is finished. Not professional, but the simple example of MeshLab. </p>
  
  <p>So what the meshlab is using, is iterators like below.</p>
  
  <pre><code>std::vector&lt;int&gt; pStorage;          
  vector&lt;int&gt;::iterator it;
  for (it = pStorage.begin(); it!=pStorage.end(); ++it){}
  </code></pre>
  
  <p>So, my question is, how and which for loop should I use for my algorithms for speeding up my application. Any suggestion?</p>
  
  <p>I have been doing research on this topic since days, I found iterators are faster, but I have tried it, used it, I found no difference in speed, why ? 
  3D graphics programming usually heavy for processing, But I have to find a fastest way to make my loops faster. </p>
  
  <p>Thanks.</p>