avoid somewhat expensive mdds position() call if possible

Change-Id: I095f6285b9e1da5869ca08a0d8e6fae9ace40cfa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134126
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
Luboš Luňák
2022-05-11 11:49:48 +02:00
parent 5b189abc13
commit 4db2b19fe8
+7 -1
View File
@@ -20,6 +20,7 @@
#include <queryiter.hxx>
#include <comphelper/flagguard.hxx>
#include <o3tl/safeint.hxx>
#include <svl/numformat.hxx>
#include <svl/zforlist.hxx>
@@ -1106,7 +1107,12 @@ void ScQueryCellIteratorAccessSpecific< ScQueryCellIteratorAccess::SortedCache >
{
++sortedCachePos;
nRow = sortedCache->rowForIndex(sortedCachePos);
maCurPos = rCol.maCells.position(nRow);
// Avoid mdds position() call if row is in the same block.
if(maCurPos.first != rCol.maCells.end() && o3tl::make_unsigned(nRow) >= maCurPos.first->position
&& o3tl::make_unsigned(nRow) < maCurPos.first->position + maCurPos.first->size)
maCurPos.second = nRow - maCurPos.first->position;
else
maCurPos = rCol.maCells.position(nRow);
}
else
{