public inbox for
 help / color / mirror / Atom feed
From: Jonathan Wakely <>
Subject: Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally
Date: Wed, 24 Aug 2022 15:24:11 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, 24 Aug 2022 at 07:17, Will Hawkins wrote:
> Until now operator+(char*, string) and operator+(string, char*) had
> different performance characteristics. The former required a single
> memory allocation and the latter required two. This patch makes the
> performance equal.
> libstdc++-v3/ChangeLog:

There should be a blank line here.

>         * libstdc++-v3/include/bits/basic_string.h (operator+(string, char*)):

The path should be relative to the ChangeLog, so should not include
the libstdc++-v3/ directory component. You can use the git gcc-verify
alias to check your commit msgs format before submitting. That runs
the same checks as will be used for the server-side hook that decides
whether to allow a push. See the customization script described at for the alaises.

Also, the overload you're changing is operator+(const string&, const
char*). The distinction matters, because there is also
operator+(string&&, const char*) and what you wrote looks more like
that one.

So I've committed it with this changelog:


           * include/bits/basic_string.h (operator+(const string&,
const char*)):
           Remove naive implementation.
           * include/bits/basic_string.tcc (operator+(const string&,
const char*)):
           Add single-allocation implementation.

Thanks for the patch!

  parent reply	other threads:[~2022-08-24 14:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22 18:15 whh8b
2022-08-22 18:15 ` whh8b
2022-08-23 16:33   ` Jonathan Wakely
2022-08-24  6:18     ` Will Hawkins
2022-08-24  9:49       ` Jonathan Wakely
2022-08-24  6:16   ` [PATCH v2] libstdc++: Optimize operator+(string/char*,string/char*) whh8b
2022-08-24  6:16     ` [PATCH] libstdc++: Optimize operator+(string/char*,string/char*) equally whh8b
2022-08-24  6:16       ` [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally whh8b
2022-08-24 14:24       ` Jonathan Wakely [this message]
2022-08-24 22:39         ` Alexandre Oliva
2022-08-24 22:47           ` Jonathan Wakely
2022-08-24 23:02             ` Jonathan Wakely
2022-08-25  5:52               ` Will Hawkins

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:

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

  git send-email \
    --in-reply-to='' \ \ \ \ \

* 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).