public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Lewis Hyatt <lhyatt@gmail.com>
Cc: "François Dumont" <frs.dumont@gmail.com>,
	libstdc++ <libstdc++@gcc.gnu.org>,
	"Dietmar Kuehl" <dietmar_kuehl@yahoo.com>
Subject: Re: ostream::operator<<() and sputn()
Date: Tue, 11 Jan 2022 01:09:03 +0000	[thread overview]
Message-ID: <CAH6eHdTj_sRH2j=nDqGEF0Mq2jzMMLp5=hnzXHyPcdbUAr70tg@mail.gmail.com> (raw)
In-Reply-To: <CAA_5UQ6FbJedoAj8phxyPjJKVvkikM9zD6ug1kk-fw12fyvDCg@mail.gmail.com>

On Mon, 10 Jan 2022 at 23:18, Lewis Hyatt wrote:
> Thanks a lot for circling back to this. I feel like your change is a
> pure improvement with little downside, so it would be great to have
> it. Let me know please if I should do anything more there.

Leave it with me.

> To me, the whole situation with sputn() is just unfortunate, because I
> think it should not have been specified to always make the virtual
> call to xsputn(), but rather only make it if needed. Then everything
> would work as well as possible. Like after this change to the
> single-char overload, a similar unexpected performance issue will
> affect something like:  cout << "a"  compared to cout << 'a', where
> now the former will make a virtual call every time and the latter
> won't. libstdc++ could handle the char* overload case as well, but
> then it still would not be permitted to handle a string or
> string_view, so at some level the standard specification is the
> constraint... Seems unlikely it will change though, so I think it
> means that avoiding sputn() wherever permitted will always be an
> avenue towards improving performance.

I think the standard is overspecified, and changing it makes sense. It will
take some time though.

  reply	other threads:[~2022-01-11  1:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 21:26 Lewis Hyatt
2021-07-14 21:30 ` Jonathan Wakely
2021-07-14 21:45   ` Lewis Hyatt
2021-07-15 17:11     ` François Dumont
2022-01-10 16:07       ` Jonathan Wakely
2022-01-10 23:18         ` Lewis Hyatt
2022-01-11  1:09           ` Jonathan Wakely [this message]
2021-07-14 21:54   ` Dietmar Kühl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH6eHdTj_sRH2j=nDqGEF0Mq2jzMMLp5=hnzXHyPcdbUAr70tg@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=dietmar_kuehl@yahoo.com \
    --cc=frs.dumont@gmail.com \
    --cc=lhyatt@gmail.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).