This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libstdc++/3269: Inefficient stream output, one 'write' call per character



>Number:         3269
>Category:       libstdc++
>Synopsis:       Inefficient stream output, one 'write' call per character
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 19 12:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Anders Furuhed
>Release:        3.0
>Organization:
>Environment:
Red Hat 7.0 and 7.1
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../configure --enable-long-long --enable-threads --enable-languages=c++ --without-newlib
Thread model: posix
gcc version 3.0
>Description:
When going from the 20010507 snapshot to gcc 3.0, I noticed a severe ostream performance degradation as chunks of characters are now being written individually, one syscall per char. I have not seen a previous report on this issue, but then I do not find my way around at all, so please bear with me if this has already been reported. 

Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../configure --enable-long-long --enable-threads --enable-languages=c++ --without-newlib (same result if --with-newlib)
Thread model: posix
gcc version 3.0
$ cat a.cc
#include <iostream>

main (int argc, char** argv)
{
   std::cerr << "Hello world" << std::endl;
}
   
$ g++ a.cc
$ strace a.out 2>&1 | egrep write\(2'
write(2, "H", 1)                        = 1
write(2, "e", 1)                        = 1
write(2, "l", 1)                        = 1
write(2, "l", 1)                        = 1
write(2, "o", 1)                        = 1
write(2, " ", 1)                        = 1
write(2, "w", 1)                        = 1
write(2, "o", 1)                        = 1
write(2, "r", 1)                        = 1
write(2, "l", 1)                        = 1
write(2, "d", 1)                        = 1
write(2, "\n", 1
$

It worked better in the 20010507 snapshot:
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../configure --enable-long-long --enable-threads --enable-languages=c++ --without-newlib
Thread model: posix
gcc version 3.0 20010507 (prerelease)
$ g++ a.cc
$ strace a.out 2>&1 | grep write
write(5, "Hello world", 11)             = 11
write(5, "\n", 1
$
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]