<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58002>58002</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `std::string` comparison is slower than GCC
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          firewave
      </td>
    </tr>
</table>

<pre>
    ```cpp
#include <string>

extern bool f(const std::string& s)
{
    return s == std::string("0");
}
```
Clang 15
```
Iterations:        100
Instructions:      1300
Total Cycles:      413
Total uOps:        1500
```
GCC 12.2
```
Iterations:        100
Instructions:      800
Total Cycles:      305
Total uOps:        1000
```
https://godbolt.org/z/E91d9ncss

```
#include <string>

extern bool f(const std::string& s)
{
    return s == "0";
}
```
Clang 15
```
Iterations:        100
Instructions:      700
Total Cycles:      1197
Total uOps:        1000
```
GCC 12.2
```
Iterations:        100
Instructions:      700
Total Cycles:      631
Total uOps:        900
```
https://godbolt.org/z/ehGfe513T
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFVMtu2zAQ_BrqQtTgQ88DD7EdBz31kh8gKVpiwYgGScVNv74r2UISt9UhCFpiKZEYze6IO5Ly7YtAJbmEPp0Q2SNyhxi3g3ZjazDiu5iCHTrE76_gfDU_kgkDVt47fESs1n6ICcfUIn4HceWwEkfEmiux2l4WGEYwaQR-hAJ7iN-ZNWKMwJzofLtk2F8Xi-TLdufk0GFa_BH8CkJlsqAPsuProGRBQXYY9Xuc8gV-9Ek6vHvRzrzCOeVv0fHb6V3qYiHfCHnY7TBlG_ZZKutVkZwUayLJX0T2Kc0PInaA6HyrvEsbH6Ajh58w7xvaNoOO8a0ZbnL8B_ssZvnXTqlWe0BpU32kCZ_tlHWVJacrIpsPGsX0D0dTUP6YGUHLMmecVIxmreBtwxuZJZucmf49t00vCdb-6SSDjX7ANuLo_NkEnHo5YDiZbAxO3FS3qR_VBmiwce55uX05Bf_d6ARbG-MI78wOBXw2LOtFeWxoVVRKKZIfayV1SSip2pqXBcuZ1pmTyrgoULEFYw3mjOcUk8mKfWYFI2C5hpWM0TqnGyK1rnLNWlqoumlrlBPzJK3bTDqmY8mCmCWpsYsAOhtTfAVljLYbjJnLQX45pt4HcbTBnOWzyebaYtb-C-ueiSU">