Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Will Hawkins
On Wed, Aug 24, 2022 at 7:03 PM Jonathan Wakely wrote: > > On Wed, 24 Aug 2022 at 23:47, Jonathan Wakely wrote: > > > > On Wed, 24 Aug 2022 at 23:39, Alexandre Oliva wrote: > > > > > > On Aug 24, 2022, Jonathan Wakely via Gcc-patches > > > wrote: > > > > > > >* include/bits/basic_s

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Jonathan Wakely via Gcc-patches
On Wed, 24 Aug 2022 at 23:47, Jonathan Wakely wrote: > > On Wed, 24 Aug 2022 at 23:39, Alexandre Oliva wrote: > > > > On Aug 24, 2022, Jonathan Wakely via Gcc-patches > > wrote: > > > > >* include/bits/basic_string.h (operator+(const string&, > > > const char*)): > > >Re

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Jonathan Wakely via Gcc-patches
On Wed, 24 Aug 2022 at 23:39, Alexandre Oliva wrote: > > On Aug 24, 2022, Jonathan Wakely via Gcc-patches > wrote: > > >* include/bits/basic_string.h (operator+(const string&, > > const char*)): > >Remove naive implementation. > >* include/bits/basic_string.tc

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Alexandre Oliva via Gcc-patches
On Aug 24, 2022, Jonathan Wakely via Gcc-patches wrote: >* 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-

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Jonathan Wakely via Gcc-patches
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

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Jonathan Wakely via Gcc-patches
On Wed, 24 Aug 2022 at 07:18, Will Hawkins wrote: > > On Tue, Aug 23, 2022 at 12:33 PM Jonathan Wakely wrote: > > > > On Mon, 22 Aug 2022 at 19:15, Will Hawkins wrote: > > > > > > Until now operator+(char*, string) and operator+(string, char*) had > > > different performance characteristics. The

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-23 Thread Will Hawkins
On Tue, Aug 23, 2022 at 12:33 PM Jonathan Wakely wrote: > > On Mon, 22 Aug 2022 at 19:15, 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 req

[PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-23 Thread whh8b
From: Will Hawkins 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: * libstdc++-v3/include

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-23 Thread Jonathan Wakely via Gcc-patches
On Mon, 22 Aug 2022 at 19:15, 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. If you don't ha

[PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-22 Thread whh8b
From: Will Hawkins 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: * libstdc++-v3/include

[PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-22 Thread whh8b
After consultation with Jonathan, we realized that there was a missed optimization opportunity in the implementation of the various forms of operator+ for string. operator+(char *, string) required a single allocation but operator+(string, char*) required two. This patch attempts to change that a