cout or printf which of the two has a faster execution speed C++? -
i have been coding in c++ long time. wondered has faster execution speed printf
or cout
?
situation: designing application in c++ , have constraints such time limit execution. application has loads printing commands on console. 1 preferable printf
or cout
?
do need care has faster execution speed? both used printing text console/stdout, typically isn't task demands ultra-high effiency. matter, wouldn't imagine there large difference in speed anyway (though 1 might expect printf
marginally quicker because lacks minor complications of object-orientedness). yet given we're dealing i/o operations here, minor difference swamped i/o overhead. certainly, if compared equivalent methods writing files, case.
printf
standard way output text stdout in c.
'cout' piping standard way output text stdout in c++.
saying this, there thread on comp.lang.cc group discussing same issue. consensus seem should choose 1 on other reasons other performance.
Comments
Post a Comment