public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/3269: Inefficient stream output, one 'write' call per character
@ 2001-06-26  3:02 bkoz
  0 siblings, 0 replies; 3+ messages in thread
From: bkoz @ 2001-06-26  3:02 UTC (permalink / raw)
  To: anders.furuhed, bkoz, gcc-bugs, gcc-prs, nobody

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libstdc++/3269: Inefficient stream output, one 'write' call per character
@ 2001-10-10 13:44 pme
  0 siblings, 0 replies; 3+ messages in thread
From: pme @ 2001-10-10 13:44 UTC (permalink / raw)
  To: anders.furuhed, bkoz, gcc-bugs, gcc-prs

Synopsis: Inefficient stream output, one 'write' call per character

State-Changed-From-To: feedback->closed
State-Changed-By: pme
State-Changed-When: Wed Oct 10 13:44:13 2001
State-Changed-Why:
    No feedback.  Explanation of sync_with_stdio() given here
    and at
    
    http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#8
    
    Thanks.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3269&database=gcc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* libstdc++/3269: Inefficient stream output, one 'write' call per character
@ 2001-06-19 12:36 anders.furuhed
  0 siblings, 0 replies; 3+ messages in thread
From: anders.furuhed @ 2001-06-19 12:36 UTC (permalink / raw)
  To: gcc-gnats

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-10-10 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-26  3:02 libstdc++/3269: Inefficient stream output, one 'write' call per character bkoz
  -- strict thread matches above, loose matches on Subject: below --
2001-10-10 13:44 pme
2001-06-19 12:36 anders.furuhed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).