sc/source/core/data/column2.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
New commits: commit d2fea40762d5d9ee918edcb4ff281e362df92c5d Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Sat Feb 26 11:16:16 2022 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Sat Feb 26 19:55:19 2022 +0100 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.lu...@collabora.com> 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