c++ - Performance difference of iostream console output between Windows and OSX? -
given following simple loop: int main (void) { (int = 0 ; < 1000000; i++) { std::cout<<i<<std::endl; } } running code on clean windows 8 professional using microsoft visual studio 2012 takes 15 secs every 100k prints. on mac os x , using same computer , takes barely 3 secs xcode output 1 mill lines. i'm 100% sure has nothing performance , related output mechanics or something. can confirm this..? know windows & visual studio fine. std::endl flush line. quite expensive this. try : std::cout << << '\n'; in other usual interactive i/o scenarios, std::endl redundant when used std::cout because input std::cin, output std::cerr, or program termination forces call std::cout.flush(). use of std::endl in place of '\n' , encouraged sources, may degrade output performance. source edit : output operation costly , depend on external factors. why slow here. example, terminal applicatio...