<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/145205>145205</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[CPP] sync_with_stdio(false) has no effect on std::cout's speed
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
saksham-joshi
</td>
</tr>
</table>
<pre>
### I compiled the below code using ```clang++``` and ```g++```.
### Time Taken
> Clang++: ```1.2 sec```
> G++ : ```.005 sec```
```cpp
#include<iostream>
int main ( void )
{
std::ios_base::sync_with_stdio( false );
std::cout.tie( nullptr );
for(unsigned int i = 0 ; i < 10000 ; ++i)
{
std::cout << i << '\n';
}
return 0;
}
```
### then I replaced std::cout with printf and then the time taken:
> Clang++: ```0.256 sec```
> G++ : ```0.249 sec```
## 🟡Anyone, please try to optimize std::cout which matches the speed of ```g++```.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VM2O4ywQfJr2pTUWwcZODj7kZ_Npb3vY-wibdswuBsvgGeV7-hV2fiaJNFZLgKnqLqBAeq9PlqgCsQNxSOQUOjdWXv71nezf_jjf6aR26lwBz5bAn9i4ftCGFIaOsCbjPrFxinDy2p4QCrZEY6Q9Ad_FuP5DadUd8TybAtvGuNX6rXvC3_IvWYz_sx-4_5I0295TrVKOnprb-AL_b4EiPoBTxsQDGi-Fb9KHYdGhbWMmRZDttfNhJNlD9mMBaxuwl9oi8DV-OK0Q-GZOVO6AbRERfVCQbSHbauffa-lpGfmzbd4_dejefVDaRX4rjaeYALIXcuOmkAZNEWcnY4Yw3pEXcOtG4OvJzsepMGrTCNkBGUK2m_t7XDHGlvGyKzpmWfh3zfhSO3IjXV87wEsQexubm1ooD9fe0owUptEiu8icpx9O5-s5h44s_sSRBiMbUk_141bhMGob2tk_Mzp6L0R7hGiPiP7eICzlovjWIvP3zMk3L5yrcIQjg80xxna1tWdnCfgeB0PSE4bxjMGhG4Lu9f_0vKRONx32MjQd-XktfiBS6Npvbkeiqkxtso1MqFqVgomiECVLuqrMqa4l51xlBRXlJq_XhWDrWhDPBVMi0RVnXLCCc5bzTcZSpaht23zN1g1frbMWcka91CY15qNP3XhKtPcTVatccCYSI2syfn4lOLf0ifMscB4fjbGKpLd6OnnImdE--HuaoIOZn5f9r18gDvjq_dn68ep00qN1SG1LTUBnH7cMeOmXTUqm0VRdCIOPs_wI_HjSoZvqtHE98GOsfWnehtH9oSYAP86KPfDjZUkfFf8XAAD__zCpXwo">