libstdc++/3269: Inefficient stream output, one 'write' call per character
bkoz@gcc.gnu.org
bkoz@gcc.gnu.org
Tue Jun 26 03:02:00 GMT 2001
Synopsis: Inefficient stream output, one 'write' call per character
Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Tue Jun 26 03:02:16 2001
Responsible-Changed-Why:
Mine.
State-Changed-From-To: open->feedback
State-Changed-By: bkoz
State-Changed-When: Tue Jun 26 03:02:16 2001
State-Changed-Why:
#include <iostream>
main (int argc, char** argv)
{
std::ios::sync_with_stdio(false);
std::cerr << "Hello world" << std::endl;
}
$ strace a.out 2>&1 | grep write
write(2, "Hello world", 11Hello world) = 11
write(2, "\n", 1
The standard streams are unbuffered by default. If you unsync them from the "C" streams with std::ios::sync_with_stdio(false) then you'll have much better luck.
-benjamin
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3269&database=gcc
More information about the Gcc-bugs
mailing list