[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

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

2022-08-23 Thread whh8b
A revision of the original patch -- based on the feedback from Jonathan -- that removes the `inline` specifier is attached.

[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