This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/3269: Inefficient stream output, one 'write' call per character
- To: gcc-gnats at gcc dot gnu dot org
- Subject: libstdc++/3269: Inefficient stream output, one 'write' call per character
- From: anders dot furuhed at pantor dot com
- Date: 19 Jun 2001 19:34:28 -0000
- Reply-To: anders dot furuhed at pantor dot com
>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: