cool#15761 Speedup calc cursor / data-entry

I suspect that what is happening here is that maDirtyTableColumnNames is
getting a lot of entries and we are refreshing stuff more than we need to.

Swap the loop ordering so that refresh each DB at most once.

Change-Id: Iee629083a81dd52365af90a820a5a78a27f6c3ef
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2556
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 5d7371e71ecf7fc9a52d70e55f3060c0aab04d56)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206683
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Noel Grandin
2026-06-16 14:47:36 +02:00
committed by Xisco Fauli
parent 8a5777a0c6
commit 9fb6bc06eb
2 changed files with 8 additions and 11 deletions
+1 -1
View File
@@ -254,7 +254,7 @@ public:
/** Refresh/update the column names with the header row's cell contents
within the given range. */
void RefreshTableColumnNames( ScDocument& rDoc, const ScRange& rRange );
void RefreshTableColumnNames( ScDocument& rDoc, const ScRangeList& rRangeList );
/** Finds the column named rName and returns the corresponding offset
within the table.
+7 -10
View File
@@ -1538,7 +1538,7 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc )
mbTableColumnNamesDirty = false;
}
void ScDBData::RefreshTableColumnNames( ScDocument& rDoc, const ScRange& rRange )
void ScDBData::RefreshTableColumnNames( ScDocument& rDoc, const ScRangeList& rRangeList )
{
// Header-less tables get names generated, completely empty a full refresh.
if (mbTableColumnNamesDirty && (!HasHeader() || maTableColumnNames.empty()))
@@ -1548,8 +1548,7 @@ void ScDBData::RefreshTableColumnNames( ScDocument& rDoc, const ScRange& rRange
}
// Check if this is affected for the range requested.
ScRange aIntersection( GetHeaderArea().Intersection( rRange));
if (!aIntersection.IsValid())
if (!rRangeList.Intersects(GetHeaderArea()))
return;
// Always fully refresh, only one cell of a range was broadcasted per area
@@ -2294,14 +2293,12 @@ std::vector<const ScDBData*> ScDBCollection::GetAllNamedDBsInArea(SCCOL nCol1, S
void ScDBCollection::RefreshDirtyTableColumnNames()
{
for (size_t i=0; i < maNamedDBs.maDirtyTableColumnNames.size(); ++i)
if (maNamedDBs.maDirtyTableColumnNames.empty())
return;
for (auto const& it : maNamedDBs)
{
const ScRange & rRange = maNamedDBs.maDirtyTableColumnNames[i];
for (auto const& it : maNamedDBs)
{
if (it->AreTableColumnNamesDirty())
it->RefreshTableColumnNames( maNamedDBs.mrDoc, rRange);
}
if (it->AreTableColumnNamesDirty())
it->RefreshTableColumnNames( maNamedDBs.mrDoc, maNamedDBs.maDirtyTableColumnNames);
}
maNamedDBs.maDirtyTableColumnNames.RemoveAll();
}