[ http://issues.apache.org/jira/browse/STDCXX-7?page=all ] Martin Sebor updated STDCXX-7: ------------------------------ Fix Version: 4.2 (was: 4.1.4) > std::operator<<(ostream&, const char*) inefficient for unbuffered file I/O > -------------------------------------------------------------------------- > > Key: STDCXX-7 > URL: http://issues.apache.org/jira/browse/STDCXX-7 > Project: C++ Standard Library > Type: Bug > Components: 27. Input/Output > Versions: 4.1.2 > Environment: All. > Reporter: Martin Sebor > Fix For: 4.2 > > operator<<(ostream&, const char*) is inefficient when the stream argument is an unbuffered fstream object: it causes a call to write() for each character (ditto for the wide character versions). This affects all platforms. Here's a test case with HP aCC: > $ cat t.cpp && nice gmake SRCS=t.cpp && truss -o truss.out ./t && grep write truss.out > #include > int main () > { > std::ofstream f ("/dev/tty"); > f.rdbuf ()->pubsetbuf (0, 0); > f << "abcdef\n"; > } > aCC -c -I/build/sebor/dev/stdlib/include/ansi -I/usr/include -D_RWSTDDEBUG -mt -D_RWSTD_USE_CONFIG -I/build/sebor/aCC-3.63-15s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include -Aa +nostl -g +d +w +W392 +W655 +W684 +W818 +W819 +W849 t.cpp > aCC t.o -o t -Aa +nostl -Wl,+s -Wl,+vnocompatwarnings -L/build/sebor/aCC-3.63-15s/lib -mt -L/build/sebor/aCC-3.63-15s/lib -lstd15s -lm > abcdef > write(4, "a ", 1) = 1 > write(4, "b ", 1) = 1 > write(4, "c ", 1) = 1 > write(4, "d ", 1) = 1 > write(4, "e ", 1) = 1 > write(4, "f ", 1) = 1 > write(4, "\n", 1) = 1 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira