llvm-capstone/libcxx
Martijn Vels f87d30cba2 Partially inline basic_string::operator=(const basic_string&)
Summary:
This change partially inlines operator=(const basic_string&) where both the input and current instance are short strings, making the assignment a fixed length inlined memcpy.

Assignments where either of the strings are long are delegate to __assign_no_alias<__is_short>(), which is templated for the long / short branch already observed in the caller.

Stable:
```
--------------------------------------------------------------------------------
Benchmark                                     Time             CPU   Iterations
--------------------------------------------------------------------------------
BM_StringAssignStr_Empty_Opaque            2.65 ns         2.66 ns    263745536
BM_StringAssignStr_Empty_Transparent       2.95 ns         2.96 ns    236494848
BM_StringAssignStr_Small_Opaque            2.93 ns         2.94 ns    237301760
BM_StringAssignStr_Small_Transparent       2.69 ns         2.69 ns    265809920
BM_StringAssignStr_Large_Opaque            19.6 ns         19.6 ns     35573760
BM_StringAssignStr_Large_Transparent       19.1 ns         19.1 ns     36716544
BM_StringAssignStr_Huge_Opaque             1901 ns         1901 ns       364544
BM_StringAssignStr_Huge_Transparent        1889 ns         1889 ns       360448
```

Unstable
```
--------------------------------------------------------------------------------
Benchmark                                     Time             CPU   Iterations
--------------------------------------------------------------------------------
BM_StringAssignStr_Empty_Opaque            1.29 ns         1.29 ns    540454912
BM_StringAssignStr_Empty_Transparent       1.11 ns         1.12 ns    628482048
BM_StringAssignStr_Small_Opaque            1.29 ns         1.29 ns    541216768
BM_StringAssignStr_Small_Transparent       1.11 ns         1.11 ns    629469184
BM_StringAssignStr_Large_Opaque            15.6 ns         15.6 ns     44945408
BM_StringAssignStr_Large_Transparent       14.9 ns         14.9 ns     46764032
BM_StringAssignStr_Huge_Opaque             1713 ns         1713 ns       401408
BM_StringAssignStr_Huge_Transparent        1704 ns         1704 ns       397312

```

Subscribers: libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D75211
2020-03-02 09:58:11 -05:00
..
benchmarks Add benchmarks for basic_string::erase 2020-02-19 17:09:25 -05:00
cmake [libc++] Explicitly specify LIBCXX_ENABLE_SHARED to try and fix CI 2020-01-29 17:29:43 -08:00
docs Reland [libc++] [P0325] Implement to_array from LFTS with updates. 2020-01-31 11:47:18 +01:00
fuzzing [libc++] Tolerate NaN returning random distributions for now 2019-12-12 17:11:13 -05:00
include Partially inline basic_string::operator=(const basic_string&) 2020-03-02 09:58:11 -05:00
lib [libc++] Fix CI and Linux failures after landing D68480 2020-02-24 11:58:25 -05:00
src Some fixes for open breaks on MacOS and UBSan 2020-02-26 20:51:19 -08:00
test [libc++] Mark more try_lock tests as possibly flaky. 2020-02-27 13:25:57 -05:00
utils [libc++] update GCC cherry-pick to build 4.8.5 2020-02-28 13:36:35 -05:00
www [libc++] Implementation of C++20's P1135R6 for libcxx 2020-02-24 10:59:35 -05:00
.clang-format
.gitignore
appveyor-reqs-install.cmd
appveyor.yml
CMakeLists.txt [CMake][libcxx] Don't wrap __config_site path in quotes on Windows 2020-01-29 19:37:35 -08:00
CREDITS.TXT
LICENSE.TXT
NOTES.TXT
TODO.TXT