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] Fix libstdc++/11378 (take2) + xsputn optmizations


> +	  // Measurement would reveal the best choice.
> +	  const size_t __chunk = 1ul << 10;
> +	  size_t __bufavail = this->epptr() - this->pptr();
> +
> +	  // Don't mistake 'uncommitted' mode buffered with unbuffered.
> +	  if (!_M_writing && this->_M_buf_size > 1)
> +	    __bufavail = this->_M_buf_size - 1;
> +
> +	  const size_t __limit = std::min(__chunk, __bufavail);
> +	  if (__n >= __limit)

It seems to me that __limit should always be set to _M_buf_size - 1,
that way the number of write calls is minimized (IIRC this is what
libio does).

Petur



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