incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Created: (STDCXX-7) std::operator<<(ostream&, const char*) inefficient for unbuffered file I/O
Date Wed, 27 Jul 2005 21:01:18 GMT
std::operator<<(ostream&, const char*) inefficient for unbuffered file I/O
--------------------------------------------------------------------------

         Key: STDCXX-7
         URL: http://issues.apache.org/jira/browse/STDCXX-7
     Project: STDCXX
        Type: Bug
  Components: 27. Input/Output  
    Versions: 4.1.2    
 Environment: All.
    Reporter: Martin Sebor


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 <fstream>

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


Mime
View raw message