How to take faster IO in c++ as cout and cin are slower!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to take faster IO in c++ as cout and cin are slower!!

16th Feb 2018, 1:53 PM
Sayan Banerjee
Sayan Banerjee - avatar
4 Answers
+ 1
Well,... for cout you are right. It is slower than printf. But the difference is way too small to make an actual performance gain if you use printf. And for cin: the worst bottleneck of cin or any other User-Input is actually the user itself. If you can type faster than cin accepts your input let me know :P Here is a comparison of printf & cout tho: http://typethinker.blogspot.de/2010/05/are-c-iostreams-really-slow.html?m=1
16th Feb 2018, 2:06 PM
Alex
Alex - avatar
+ 1
im talking about competitive coding where user is much faster than the runtime itself!! your article is helpful bt cant agree to what u said about cin !! 😑
16th Feb 2018, 2:13 PM
Sayan Banerjee
Sayan Banerjee - avatar
+ 1
ios_base::sync_with_stdio(false)
16th Feb 2018, 2:18 PM
Alex
Alex - avatar
0
thanks alex, for the article
16th Feb 2018, 2:10 PM
storm
storm - avatar