This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: PATCH: Improve efficiency (as measured by system calls made)
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: rittle at labs dot mot dot com
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Wed, 28 Nov 2001 16:37:10 -0800 (PST)
- Subject: Re: PATCH: Improve efficiency (as measured by system calls made)
> [Sorry, I have been away from work e-mail due to holiday and Civ3
> addiction...]
Civ3 does seem to be addictive...
> My patch removes an unconditional _M_file->sync() call from
> include/bits/fstream.tcc (basic_filebuf::_M_really_overflow). As we
> know, _M_really_overflow() is called *a lot* when the C++ output
> buffer size is 1 and we are relying on the C buffer for reasonable
> performance...
Hmm.
> Scott thought that cout.flush() / cerr.flush() calls should
> synchronize IO across low-level file handles. You did not dispute and
> I do not dispute his claim in terms of user expectation and I agree
> that my patch breaks his ideal situation after manually testing his
> case. Scott also said that without any explicit ostream::flush()
> calls he did not expect any particular interleaving between distinct
> C++-layer handles that happen to map to a shared low-level file
> handle. I agree with that as well. Should we not make the
> infrequently-called ostream::flush() do this expensive (system
> call-wise) operation instead of in the main line of
> _M_really_overflow()?
Perhaps you're right. Have you tried moving it?
-benjamin