title: Array memcpy more than 1000 times faster than vector stl::copy on on ideone?
body: <p>I posted the following cone on ideone under <a href="http://ideone.com/Hp9pL8" rel="nofollow">http://ideone.com/Hp9pL8</a>:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;chrono&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  #include &lt;cstring&gt;
  
  using namespace std;
  
  int main() {
    constexpr size_t elems = 500000;
    {
      int array_source[elems];
      int array_destination[elems];
      iota(begin(array_source),end(array_source),0);
      auto start = chrono::high_resolution_clock::now();
      memcpy (array_destination, array_source, elems * sizeof(int));
      auto stop = chrono::high_resolution_clock::now();
      auto duration = stop - start;
      auto nanoseconds = chrono::duration_cast&lt;chrono::nanoseconds&gt;(duration);
      cout &lt;&lt; "Duration of old style copy: " &lt;&lt; nanoseconds.count() &lt;&lt;  " ns." &lt;&lt; endl;
    }
    {
      vector&lt;int&gt; vector_source(elems);
      vector&lt;int&gt; vector_destination(elems);
      iota(begin(vector_source),end(vector_source),0);
      auto start = chrono::high_resolution_clock::now();
      copy(begin(vector_source), end(vector_source), begin(vector_destination));
      auto stop = chrono::high_resolution_clock::now();
      auto duration = stop - start;
      auto nanoseconds = chrono::duration_cast&lt;chrono::nanoseconds&gt;(duration);
      cout &lt;&lt; "Duration of stl style copy: " &lt;&lt; nanoseconds.count() &lt;&lt;  " ns." &lt;&lt; endl;
    }
  }
  </code></pre>
  
  <p>Output is:</p>
  
  <pre><code>Duration of old style copy: 280 ns.
  Duration of stl style copy: 931438 ns.
  </code></pre>
  
  <p>I expected both approaches to produce nearly the same instructions on optimized build. Why is copying vector more than 1000 times slower. Is ideone not using any optimization at all?</p>