I\'m timing the difference between various ways to print text to standard output. I\'m testing cout
, printf
, and ostringstream
using both
Using std::endl
is equivalent to writing
stream << "\n";
stream.flush();
Don't use std::endl
unless you actually want to trigger flushing, and / or don't care about output performance.
Also, don't worry about different line endings on different platforms, your implementation will translate "\n"
to the line ending appropriate for your platform.