[Patch] Fix libstdc++/11378 (take2) + xsputn optmizations
Pétur Runólfsson
peturr02@ru.is
Mon Jul 7 10:08:00 GMT 2003
> + // 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
More information about the Libstdc++
mailing list