teak-llvm/libcxx
Eric Fiselier 58c7fa5ade [libc++] Optimize basic_string::operator=(const basic_string&) for SSO assignments
This change optimizes the operator=() assignment for short strings by direcly
copying the raw data from the source into the current instance. This creates an
optimized / inlined mempcy up to over 2X faster for short string assignments.
With inlining enabled for operator=, performance is up to 6X faster.

Benchmarks 'as is':
name                                    old time/op   new time/op    delta
BM_StringAssignStr_Empty_Opaque         6.05ns ± 2%   3.59ns ± 0%  -40.67%
BM_StringAssignStr_Empty_Transparent    5.15ns ± 0%   3.08ns ± 0%  -40.12%
BM_StringAssignStr_Small_Opaque         7.71ns ± 0%   3.59ns ± 0%  -53.45%
BM_StringAssignStr_Small_Transparent    7.66ns ± 0%   3.09ns ± 0%  -59.66%
BM_StringAssignStr_Large_Opaque         24.1ns ± 0%   24.9ns ± 0%   +3.22%
BM_StringAssignStr_Large_Transparent    22.2ns ± 0%   22.8ns ± 0%   +2.77%
BM_StringAssignStr_Huge_Opaque           315ns ± 6%    320ns ± 5%     ~
BM_StringAssignStr_Huge_Transparent      318ns ± 5%    321ns ± 4%     ~

Benchmarks with partial inlining operator=():
name                                    old time/op   new time/op    delta
BM_StringAssignStr_Empty_Opaque         5.94ns ± 2%   1.95ns ± 0%  -67.21%
BM_StringAssignStr_Empty_Transparent    5.14ns ± 0%   1.04ns ± 1%  -79.73%
BM_StringAssignStr_Small_Opaque         7.69ns ± 0%   1.96ns ± 0%  -74.48%
BM_StringAssignStr_Small_Transparent    7.65ns ± 0%   1.04ns ± 0%  -86.40%
BM_StringAssignStr_Large_Opaque         24.1ns ± 0%   24.5ns ± 0%   +1.61%
BM_StringAssignStr_Large_Transparent    22.2ns ± 0%   21.1ns ± 0%   -4.70%
BM_StringAssignStr_Huge_Opaque           317ns ± 5%    323ns ± 4%     ~
BM_StringAssignStr_Huge_Transparent      318ns ± 5%    320ns ± 5%     ~

Patch by Martijn Vels (mvels@google.com)
Reviewed as https://reviews.llvm.org/D72704
2020-01-15 17:27:10 -05:00
..
benchmarks [libc++] Add additional benchmark functions to libcxx/benchmarks/string.bench 2020-01-07 16:31:40 -05:00
cmake [libcxx{,abi}] Don't link libpthread and libdl on Fuchsia 2019-12-06 11:15:15 -08:00
docs Bump the trunk major version to 11 2020-01-15 13:38:01 +01:00
fuzzing [libc++] Tolerate NaN returning random distributions for now 2019-12-12 17:11:13 -05:00
include [libc++] Optimize basic_string::operator=(const basic_string&) for SSO assignments 2020-01-15 17:27:10 -05:00
lib [libc++] Add missing revision number in ABI changelog 2019-10-03 16:50:05 +00:00
src [libc++] Explicitly enumerate std::string external instantiations - Attempt 2 2020-01-15 17:12:49 -05:00
test [libcxx] [test] Add casts to avoid signed/unsigned mismatch warnings on MSVC++ 2020-01-14 01:11:10 -08:00
utils [libcxx] Fix a typo in config.py 2019-12-26 18:51:09 +03:00
www [libc++] [P0920] [P1661] Update status page. 2019-11-15 00:12:34 +01:00
.arcconfig
.clang-format
.gitignore
appveyor-reqs-install.cmd Attempt to upgrade compiler used by appveyor builds 2019-04-03 20:40:01 +00:00
appveyor.yml disable appveyor config for MSVC 2015 2019-04-03 20:36:51 +00:00
CMakeLists.txt Bump the trunk major version to 11 2020-01-15 13:38:01 +01:00
CREDITS.TXT [libcxx] Add Sergej Jaskiewicz to CREDITS.txt 2019-11-21 12:06:10 +03:00
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
NOTES.TXT
TODO.TXT