diff options
author | Noel Grandin <noel@peralex.com> | 2021-01-25 14:43:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-25 17:54:54 +0100 |
commit | aa98ed61a7b1e50bcc4f64ceaea3bb0cda360bb4 (patch) | |
tree | 6dbb2acb28f34084275138afa6bbe047c960697c /svl/source | |
parent | 46e525c36e62c7cb365f1a1f34373e726cfb49b7 (diff) |
tdf#92456 improve VLOOKUP perf
shave 5% of the time here - ref-counting triggered by copying
svl::SharedString is significant, so return by const&
instead of by value
Change-Id: Ic702632da45d75dddab33d6ce1e6f1097ff70de9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109900
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl/source')
-rw-r--r-- | svl/source/misc/sharedstring.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/svl/source/misc/sharedstring.cxx b/svl/source/misc/sharedstring.cxx index 9aff3eb0eab5..d3b2cac051ce 100644 --- a/svl/source/misc/sharedstring.cxx +++ b/svl/source/misc/sharedstring.cxx @@ -11,13 +11,15 @@ namespace svl { -SharedString SharedString::getEmptyString() +/** ref-counting traffic associated with SharedString temporaries can be significant, so use a singleton here, so we can return a const& from getEmptyString */ +static OUString EMPTY(u""); +const SharedString EMPTY_SHARED_STRING(EMPTY.pData, EMPTY.pData); + +const SharedString & SharedString::getEmptyString() { // unicode string array for empty string is globally shared in OUString. // Let's take advantage of that. - rtl_uString* pData = nullptr; - rtl_uString_new(&pData); - return SharedString(pData, pData); + return EMPTY_SHARED_STRING; } SharedString::SharedString() : mpData(nullptr), mpDataIgnoreCase(nullptr) {} |