summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-08-16 12:42:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-08-16 14:38:38 +0200
commit9a03308fafee8f424eba399c1aae56af02beafb0 (patch)
treefc2808b44f3a37b6e75f47ab9fac01a85be0fd2e /sfx2
parentc70b86588fe56f3e1077f3f904c379afda70c6be (diff)
tdf#126663 speed up styles display by sorting twice
Change-Id: Ice5c2d0fd92196984efebf8c1183c1ed8399d1fb Reviewed-on: https://gerrit.libreoffice.org/77573 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/templdlg.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index c9e654afed45..cf2de5311f0e 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1187,6 +1187,12 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(StyleFlags nFlags)
aStrings.push_back(pStyle->GetName());
pStyle = pStyleSheetPool->Next();
}
+
+ // Paradoxically, with a list and non-Latin style names,
+ // sorting twice is faster than sorting once.
+ // The first sort has a cheap comparator, and gets the list into mostly-sorted order.
+ // Then the second sort needs to call its (much more expensive) comparator less often.
+ std::sort(aStrings.begin(), aStrings.end());
std::sort(aStrings.begin(), aStrings.end(),
[&aSorter](const OUString& rLHS, const OUString& rRHS) {
return aSorter.compare(rLHS, rRHS) < 0;