title: My C++11 test show that sort(vector<string>) is even slower than C++03, any error?
body: <p>With right value reference and move semantics, C++11's swap/sort speed, should be equal or greater than C++03. So I designed a simple experiment to test this.</p>
  
  <p>I compile and run it with -O2, with c++03 and c++11 standard.</p>
  
  <pre><code>$g++ test.cpp -O2 &amp;&amp; ./a.out
  10240000 end construction
  sort 10240000 spent1.40035
  
  $g++ test.cpp -O2 -std=c++11 &amp;&amp; ./a.out
  10240000 end construction
  sort 10240000 spent2.25684
  </code></pre>
  
  <p>So it seems with C++11 enabled, program is slower.
  I'm on a very new mac and gcc environment:</p>
  
  <pre><code>$gcc -v
  Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
  Apple LLVM version 7.3.0 (clang-703.0.31)
  Target: x86_64-apple-darwin15.6.0
  Thread model: posix
  InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  </code></pre>
  
  <p>Below is source code:</p>
  
  <pre><code>#include&lt;string&gt;
  #include&lt;algorithm&gt;
  #include&lt;vector&gt;
  #include&lt;cstdlib&gt;
  #include&lt;cstdio&gt;
  #include&lt;iostream&gt;
  #include&lt;ctime&gt;
  using namespace std;
  string randomString()
  {
      const size_t scale=600;
      char ret[scale];
      for(size_t i=0;i&lt;scale;++i)
      {
          double rand0to1=(double)rand()/RAND_MAX;
          ret[i]=(char)rand0to1*92+33;
      }
      return ret;
  }
  int main()
  {
      srand(time(NULL));
      const size_t scale=10240000;
      vector&lt;string&gt; vs;
      vs.reserve(scale);
      for(size_t i=0;i&lt;scale;++i)
      {
          vs.push_back(randomString());
      }
      cout&lt;&lt;vs.size()&lt;&lt;" end construction\n";
      clock_t begin=clock();
      sort(vs.begin(),vs.end());
      clock_t end=clock();
      double duration=(double)(end-begin)/CLOCKS_PER_SEC;
      cout&lt;&lt;"sort "&lt;&lt;scale&lt;&lt;" spent"&lt;&lt;duration&lt;&lt;"\n";
      return 0;
  }
  </code></pre>
  
  <p>Any error with my program or understanding, how to explain my test result?</p>
  
  <p>Really need your expertise on this!</p>