title: C++ : Time taken in a for loop iteration
body: <p>Just as an experiment I have been running the following block of code. Where I estimate the time taken for different number of iterations in a <code>for</code> loop.</p>
  
  <pre><code>std::vector&lt;double&gt; numIt= {1e2, 1e4, 1e6, 1e8, 1e9, 1e10,1e11};
  for(int i=0; i&lt; (int) numIt.size() ; i++ )
  {
      int tmp=0;
      std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now();
      for (int j=0; j&lt; numIt[i]; j++)
      {
          tmp=i-j;
      }
  
      std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now();
      auto durationFPextraction = std::chrono::duration_cast&lt;std::chrono::milliseconds&gt;( t2 - t1 ).count();
      std::cout &lt;&lt;i&lt;&lt; "\t"&lt;&lt; tmp&lt;&lt;"\t"&lt;&lt;numIt[i] &lt;&lt; "\t" &lt;&lt; durationFPextraction &lt;&lt;std::endl;
  }
  </code></pre>
  
  <p>It prints the following, and has been running for a couple of hours now to iterate through <code>1e+10</code> length <code>for</code> loop. If the time taken is linear shouldn't it have taken ~14000 milliseconds (14 seconds) ? </p>
  
  <p><code>0  -99 100 0
  1   -9998   10000   0
  2   -999997 1e+06   2
  3   -99999996   1e+08   144
  4   -999999995  1e+09   1394</code></p>