title: small program much slower in visual studio 2012 vs. visual studio 2005
body: <p>We are using Visual Studio 2005.  We are looking at maybe upgrading to Visual Studio 2012 once it is released.  I tried this small program in Visual Studio 2012 RC and was surprised to see it ran more than 2X slower than it does in Visual Studio 2005.  In VS2012 I used default release build settings.  For me it takes about 20ms in VS2005 and about 50ms in VS2012.  Why is it that much slower?</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;deque&gt;
  
  using namespace std;
  
  deque&lt;int&gt; d;
  
  int main(int argc, char* argv[])
  {
      const int COUNT = 5000000;
  
      timeBeginPeriod(1);    
  
      for (int i = 0; i &lt; COUNT; ++i)
      {
          d.push_back(i);
      }
  
      double sum = 0;
  
      DWORD start = timeGetTime();
  
      for (int i = 0; i &lt; COUNT; ++i)
      {
          sum += d[i];
      }
  
      printf("time=%dms\n", timeGetTime() - start);
  
      printf("sum=%f\n", sum);
  
      return 0;
  }
  </code></pre>