This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Improve efficiency (as measured by system calls made)



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

If I followed the mailing list traffic from the time Scott first
proposed the patch and you reworked it, then the obvious way to make
the change breaks the same test case that led to the current
situation.  I am sorry I reraise old stuff without fully understanding
it.  Since performance enhancements are in scope for 3.1, I will
continue to look for a way to reduced system calls yet not break the
various test cases.

Regards,
Loren


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