[libcxx-commits] [PATCH] D72704: Optimize basic_string::operator=(const basic_string&) for SSO assignments
Martijn Vels via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jan 15 09:35:09 PST 2020
mvels updated this revision to Diff 238299.
mvels added a comment.
Force single branch on fast path
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72704/new/
https://reviews.llvm.org/D72704
Files:
libcxx/include/string
Index: libcxx/include/string
===================================================================
--- libcxx/include/string
+++ libcxx/include/string
@@ -2266,7 +2266,11 @@
if (this != &__str)
{
__copy_assign_alloc(__str);
- return assign(__str.data(), __str.size());
+ const bool __str_is_long = __str.__is_long(); // Force single branch
+ if (__is_long() || __str_is_long) {
+ return assign(__str.data(), __str.size());
+ }
+ __r_.first().__r = __str.__r_.first().__r;
}
return *this;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72704.238299.patch
Type: text/x-patch
Size: 562 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200115/26c135c3/attachment.bin>
More information about the libcxx-commits
mailing list