summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode/ndtxt.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-05-29 12:51:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-05-30 09:40:08 +0200
commit799dac2e621bf14f613b3ee4f6a711b49c0c5e81 (patch)
tree58195809acf0d4299bad65095853952457193c70 /sw/source/core/txtnode/ndtxt.cxx
parentc329a1c11299b999152b45343961e79e66be405a (diff)
tdf#125372 writer, file with lots of hints very slow to open, part5
Takes load time from 3m to 2m11 (*) Add a list sorted by which/start (*) Use it in lcl_GetTextAttrs (*) Fix GetLastPosSortedByEnd, previously we could potentially static_cast the search item to something it is not (*) Add assert to SwpHints::DeleteAtPos to verify that we don't need sorting of the main list when deleting. Change-Id: If82ea650172ca88486507f31b45cac8d22682451 Reviewed-on: https://gerrit.libreoffice.org/73152 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/txtnode/ndtxt.cxx')
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx16
1 files changed, 6 insertions, 10 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 4135b308fcc0..4a8ee16f7503 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1672,19 +1672,15 @@ lcl_GetTextAttrs(
default: assert(false);
}
- for( size_t i = 0; i < nSize; ++i )
+ for( size_t i = pSwpHints->GetFirstPosSortedByWhichAndStart(nWhich); i < nSize; ++i )
{
- SwTextAttr *const pHint = pSwpHints->Get(i);
+ SwTextAttr *const pHint = pSwpHints->GetSortedByWhichAndStart(i);
+ if (pHint->Which() != nWhich)
+ break; // hints are sorted by which&start, so we are done...
+
sal_Int32 const nHintStart = pHint->GetStart();
if (nIndex < nHintStart)
- {
- return; // hints are sorted by start, so we are done...
- }
-
- if (pHint->Which() != nWhich)
- {
- continue;
- }
+ break; // hints are sorted by which&start, so we are done...
sal_Int32 const*const pEndIdx = pHint->GetEnd();
// cannot have hint with no end and no dummy char