This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
RE: [Patch] Fix libstdc++/11378 (take2) + xsputn optmizations
- From: Pétur Runólfsson <peturr02 at ru dot is>
- To: "Paolo Carlini" <pcarlini at unitus dot it>,<libstdc++ at gcc dot gnu dot org>
- Cc: "bkoz" <bkoz at redhat dot com>
- Date: Mon, 7 Jul 2003 10:08:48 -0000
- Subject: 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