summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-02-26 11:16:16 +0100
committerLuboš Luňák <l.lunak@collabora.com>2022-02-26 19:55:19 +0100
commitd2fea40762d5d9ee918edcb4ff281e362df92c5d (patch)
tree011fd2d7afae5d7d23901ce5c9241ce500b655cf /sc
parentdcf98b570fc33bc9ee3bdf5591c6cc92cfbf3aa1 (diff)
optimize ScColumns::HasCellNotes()
This probably doesn't matter much for optimized code, but in dbgutil builds this avoids all the libstdc++ iterators mutex locking (WTH does libstdc++ debug mode need to lock anything?). It's functionally equivalent (similarly to ScColumn::IsEmptyData(), and the container can contain only notes or empty elements), and cuts run time of e.g. sc_uicalc test to about a half. Change-Id: Ibb2bd8be522de889a8a06cbb7a4f880c9b065c71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130604 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/column2.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index c6be6f4ce8f2..f24ac6726495 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2053,10 +2053,9 @@ void ScColumn::DeleteCellNotes( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1,
bool ScColumn::HasCellNotes() const
{
- return std::any_of(maCellNotes.begin(), maCellNotes.end(),
- [](const auto& rCellNote) {
- // Having a cellnote block automatically means there is at least one cell note.
- return rCellNote.type == sc::element_type_cellnote; });
+ if (maCellNotes.block_size() == 1 && maCellNotes.begin()->type == sc::element_type_empty)
+ return false; // all elements are empty
+ return true; // otherwise some must be notes
}
SCROW ScColumn::GetCellNotesMaxRow() const