title: Why hash_map and unordered_map on my machine are extremely slow?
body: <p>I tested them with this code (on Visual Studio 2010 sp1):</p>
  
  <pre><code>#include &lt;ctime&gt;
  #include &lt;iostream&gt;
  #include &lt;map&gt;
  #include &lt;unordered_map&gt;
  #include &lt;hash_map&gt;
  
  int main()
  { 
      clock_t time;
      int LOOP = (1 &lt;&lt; 16);
      std::map&lt;int, int&gt; my_map;
      std::unordered_map&lt;int, int&gt; map_unordered_map;
      std::hash_map&lt;int, int&gt; my_hash_map;
  
      time = clock();
      for (int i = 0; i != LOOP; ++i)
      {
          my_map[i] = i;
      }
      std::cout &lt;&lt; "map: " &lt;&lt; ((double)(clock() - time) / CLOCKS_PER_SEC) &lt;&lt; std::endl;
  
      time = clock();
      for (int i = 0; i != LOOP; ++i)
      {
          map_unordered_map[i] = i;
      }
      std::cout &lt;&lt; "unordered_map: " &lt;&lt; ((double)(clock() - time) / CLOCKS_PER_SEC) &lt;&lt; std::endl;
  
      time = clock();
      for (int i = 0; i != LOOP; ++i)
      {
          my_hash_map[i] = i;
      }
      std::cout &lt;&lt; "hash_map: " &lt;&lt; ((double)(clock() - time) / CLOCKS_PER_SEC) &lt;&lt; std::endl;
  
      system("PAUSE");
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>And the result are so strange:</p>
  
  <p>In DEBUG:
  map: 0.289
  unordered_map: 10.738
  hash_map: 10.58
  Press any key to continue . . .</p>
  
  <p>In RELEASE:
  map: 0.101
  unordered_map: 0.463
  hash_map: 0.429
  Press any key to continue . . .</p>