summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-09-19 12:29:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-09-20 10:33:24 +0200
commit77dec7588c9141b03f8ec0139eb96c298b26f261 (patch)
treed56625bf373e1966d57854a61168385c8a08e734 /include
parent3aff00ea2ff704547a4d9fa6e2bb2141eb57bf1d (diff)
tdf#109158 improve sorting when loading large autocorrect file
reduces time from 2.0s to 1.7s reduce work by (*) reserving some arrays (*) pre-sorting with a cheaper comparator (*) don't copy when returning result, just return a const& (*) flattening the data-structures to reduce pointer-chasing Change-Id: I972bd7ffdbf2121c2d38c24aca9618ca708e920c Reviewed-on: https://gerrit.libreoffice.org/79119 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/editeng/svxacorr.hxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index 52cae8f9faee..e6477f28dac1 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -28,6 +28,7 @@
#include <editeng/swafopt.hxx>
#include <editeng/editengdllapi.h>
+#include <boost/optional.hpp>
#include <map>
#include <memory>
@@ -153,13 +154,14 @@ public:
// free any objects still in the set
~SvxAutocorrWordList();
void DeleteAndDestroyAll();
- bool Insert(std::unique_ptr<SvxAutocorrWord> pWord) const;
- std::unique_ptr<SvxAutocorrWord> FindAndRemove(SvxAutocorrWord *pWord);
+ const SvxAutocorrWord* Insert(SvxAutocorrWord aWord) const;
+ boost::optional<SvxAutocorrWord> FindAndRemove(SvxAutocorrWord *pWord);
void LoadEntry(const OUString& sWrong, const OUString& sRight, bool bOnlyTxt);
bool empty() const;
- typedef std::vector<SvxAutocorrWord *> Content;
- Content getSortedContent() const;
+ struct CompareSvxAutocorrWordList;
+ typedef std::vector<SvxAutocorrWord> AutocorrWordSetType;
+ const AutocorrWordSetType & getSortedContent() const;
const SvxAutocorrWord* SearchWordsInList(const OUString& rTxt, sal_Int32& rStt, sal_Int32 nEndPos) const;
};