From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: File output and buffering
Date: Wed, 20 Aug 2008 07:41:30 -0700 (PDT)
Date: 2008-08-20T07:41:30-07:00 [thread overview]
Message-ID: <93cbe6e8-98f5-4e44-8eb3-c0e0e911f702@m73g2000hsh.googlegroups.com> (raw)
In-Reply-To: 48ac19fc$0$11747$9b4e6d93@newsspool1.arcor-online.net
On 20 Sie, 15:19, Georg Bauhaus <rm.dash-bauh...@futureapps.de> wrote:
> Using the following stupid programs for comparison,
> and using strace, I get 3370 calls to write(2) from C,
> but 50_000 from both C++ and Ada.
The C++ part can be explained by the fact that you did not use it
properly.
> std::cout << s << std::endl;
Try this instead:
std::cout << s << '\n';
The difference is that std::endl performs *two* actions on the given
stream: it inserts the newline and... flushes. If you intend to only
insert the newline character, do what you mean. It is even less
typing.
(yes, 99% of "benchmarks" available on the web are broken for the same
reason)
--
Maciej Sobczak * www.msobczak.com * www.inspirel.com
Database Access Library for Ada: www.inspirel.com/soci-ada
prev parent reply other threads:[~2008-08-20 14:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-19 20:27 File output and buffering Maciej Sobczak
2008-08-20 6:45 ` Georg Bauhaus
2008-08-20 8:43 ` Maciej Sobczak
2008-08-20 8:59 ` Maciej Sobczak
2008-08-20 9:21 ` Dmitry A. Kazakov
2008-08-20 14:44 ` Maciej Sobczak
2008-08-20 15:39 ` Dmitry A. Kazakov
2008-08-21 7:10 ` Maciej Sobczak
2008-08-21 9:24 ` Dmitry A. Kazakov
2008-08-21 20:54 ` Maciej Sobczak
2008-08-21 21:27 ` Dmitry A. Kazakov
2008-08-22 11:53 ` Maciej Sobczak
2008-08-22 13:22 ` Dmitry A. Kazakov
2008-08-22 21:41 ` Maciej Sobczak
2008-08-23 10:25 ` Dmitry A. Kazakov
2008-08-23 13:41 ` Steve
2008-08-23 14:33 ` Dmitry A. Kazakov
[not found] ` <Q7adnfmCI6Ly6S3VnZ2dnUVZ_jOdnZ2d@earthlink.com>
2008-08-23 22:00 ` Maciej Sobczak
2008-08-20 13:19 ` Georg Bauhaus
2008-08-20 14:41 ` Maciej Sobczak [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox