title: Why sqrt in global scope is much slower than std::sqrt in MinGW?
body: <p>Consider the following code:</p>
  
  <pre><code>#include &lt;cmath&gt;
  #include &lt;cstdio&gt;
  
  const int COUNT = 100000000;
  
  int main()
  {
      double sum = 0;
      for (int i = 1; i &lt;= COUNT; ++i)
          sum += sqrt(i);
      printf("%f\n", sum);
      return 0;
  }
  </code></pre>
  
  <p>It runs 5.5s on my computer. However, if I change <code>sqrt</code> into <code>std::sqrt</code>, It will run only 0.7s.</p>
  
  <p>I know that if I use <code>sqrt</code>, I'm using the function from C library, and if I use <code>std::sqrt</code>, I'm using the one in <code>&lt;cmath&gt;</code>.</p>
  
  <p>But <code>&lt;cmath&gt;</code> doesn't define one for <code>int</code>, and if I change the type of <code>i</code> into <code>double</code>, they will run for equal speed. So the compiler isn't optimizing for <code>int</code>. This seems to only happen to <code>sqrt</code> in Windows.</p>
  
  <p>So why is <code>std::sqrt</code> much faster than <code>sqrt</code>, but not other functions? And why in Linux they are not?</p>