<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Simple loop with IO - LLVM much slower than GCC"
   href="https://bugs.llvm.org/show_bug.cgi?id=47321">47321</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Simple loop with IO - LLVM much slower than GCC
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david.bolvansky@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Code:
#include <string>
#include <map>
#include <fstream>
#include <iostream>
int main(int argc, char **argv) {
  if (argc != 2)
    return 1;
  std::string dict = argv[1];
  std::map<unsigned, unsigned> pwd_dist;

  std::ifstream file(dict);
  if (!file.is_open())
    return 1;
  std::string line;
  while (getline(file, line)) {
    unsigned pwd_len = line.length();
    pwd_dist[pwd_len] += 1;
  }
  file.close();

  for (std::map<unsigned, unsigned>::iterator it = pwd_dist.begin();
       it != pwd_dist.end(); it++) {
    std::cout << it->first         // string (key)
              << ':' << it->second ;// string's value
    if (std::next(it) != pwd_dist.end())
       std::cout       << ';';
  }
  return 0;
}

Compiled with -O3.

Clang:
0m1,219s

GCC:
0m0,623s</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>