[Libreoffice-commits] core.git: 2 commits - sc/source
Eike Rathke
erack at redhat.com
Thu Sep 22 08:06:48 UTC 2016
sc/source/core/data/document.cxx | 18 ++++++++++++++----
sc/source/core/data/formulacell.cxx | 8 +++++++-
2 files changed, 21 insertions(+), 5 deletions(-)
New commits:
commit 60d0b992ea3a910be79ae4a8e8b0bb32a358b18a
Author: Eike Rathke <erack at redhat.com>
Date: Wed Sep 21 21:42:10 2016 +0200
sc-perf: tdf#87101 add bulk scope for BroadcastRecalcOnRefMove() calls
Bulk scope prevents repeated broadcast/notify/track cycles of identical areas
during mass broadcasts.
Brings insertion time of tdf#87101 bugdoc from 3min30 down to 2min30
Change-Id: I360fd52b622a8a327cdede47ed398260b7e8b4f6
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index da10296..2d698ac 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1238,6 +1238,16 @@ struct BroadcastRecalcOnRefMoveHandler : std::unary_function<ScTable*, void>
if (p)
p->BroadcastRecalcOnRefMove();
}
+
+ explicit BroadcastRecalcOnRefMoveHandler( ScDocument* pDoc ) :
+ aSwitch( *pDoc, false),
+ aBulk( pDoc->GetBASM())
+ {
+ }
+
+private:
+ sc::AutoCalcSwitch aSwitch; // first for ctor/dtor order, destroy second
+ ScBulkBroadcast aBulk; // second for ctor/dtor order, destroy first
};
}
@@ -1340,7 +1350,7 @@ bool ScDocument::InsertRow( SCCOL nStartCol, SCTAB nStartTab,
if (*it)
(*it)->SetDirtyIfPostponed();
- std::for_each(maTabs.begin(), maTabs.end(), BroadcastRecalcOnRefMoveHandler());
+ std::for_each(maTabs.begin(), maTabs.end(), BroadcastRecalcOnRefMoveHandler( this));
}
bRet = true;
}
@@ -1441,7 +1451,7 @@ void ScDocument::DeleteRow( SCCOL nStartCol, SCTAB nStartTab,
if (*it)
(*it)->SetDirtyIfPostponed();
- std::for_each(maTabs.begin(), maTabs.end(), BroadcastRecalcOnRefMoveHandler());
+ std::for_each(maTabs.begin(), maTabs.end(), BroadcastRecalcOnRefMoveHandler( this));
}
pChartListenerCollection->UpdateDirtyCharts();
@@ -1542,7 +1552,7 @@ bool ScDocument::InsertCol( SCROW nStartRow, SCTAB nStartTab,
std::for_each(maTabs.begin(), maTabs.end(), SetDirtyIfPostponedHandler());
// Cells containing functions such as CELL, COLUMN or ROW may have
// changed their values on relocation. Broadcast them.
- std::for_each(maTabs.begin(), maTabs.end(), BroadcastRecalcOnRefMoveHandler());
+ std::for_each(maTabs.begin(), maTabs.end(), BroadcastRecalcOnRefMoveHandler( this));
}
bRet = true;
}
@@ -1632,7 +1642,7 @@ void ScDocument::DeleteCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTA
if (*it)
(*it)->SetDirtyIfPostponed();
- std::for_each(maTabs.begin(), maTabs.end(), BroadcastRecalcOnRefMoveHandler());
+ std::for_each(maTabs.begin(), maTabs.end(), BroadcastRecalcOnRefMoveHandler( this));
}
pChartListenerCollection->UpdateDirtyCharts();
commit 5306fabfea74c01b49f96920564c7eefa91e87aa
Author: Eike Rathke <erack at redhat.com>
Date: Wed Sep 21 12:39:41 2016 +0200
tdf#87101 Revert "fdo#83067 also volatile cells need to listen to all refe"...
This reverts commit 0792aef9010007d5738723d8930990028bef2f9e.
It created a bottleneck with massive use of OFFSET() functions mixed
with other references, see tdf#87101 bugdoc. Will have to come up with a
different approach to solve the "broadcast cell move" problem.
Additionally, the unit test for tdf#83067 and the original problem still
work with the reverted change, so we seem to generally have fixed
something else in the meantime..
Conflicts:
sc/source/core/data/formulacell.cxx
Change-Id: Ida2e26398f99ff5878d43ffb46035bc4441dfff6
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index b32d4ed..5968110 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2144,7 +2144,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
if (pCode->IsRecalcModeAlways())
{
// The formula was previously volatile, but no more.
- pDocument->EndListeningArea(BCA_LISTEN_ALWAYS, false, this);
+ EndListeningTo(pDocument);
pCode->SetExclusiveRecalcModeNormal();
}
else
@@ -4280,6 +4280,8 @@ void ScFormulaCell::StartListeningTo( ScDocument* pDoc )
if( pArr->IsRecalcModeAlways() )
{
pDoc->StartListeningArea(BCA_LISTEN_ALWAYS, false, this);
+ SetNeedsListening( false);
+ return;
}
pArr->Reset();
@@ -4321,6 +4323,8 @@ void ScFormulaCell::StartListeningTo( sc::StartListeningContext& rCxt )
if( pArr->IsRecalcModeAlways() )
{
rDoc.StartListeningArea(BCA_LISTEN_ALWAYS, false, this);
+ SetNeedsListening( false);
+ return;
}
pArr->Reset();
@@ -4392,6 +4396,7 @@ void ScFormulaCell::EndListeningTo( ScDocument* pDoc, ScTokenArray* pArr,
if ( GetCode()->IsRecalcModeAlways() )
{
pDoc->EndListeningArea(BCA_LISTEN_ALWAYS, false, this);
+ return;
}
if (!pArr)
@@ -4443,6 +4448,7 @@ void ScFormulaCell::EndListeningTo( sc::EndListeningContext& rCxt )
if (pArr->IsRecalcModeAlways())
{
rDoc.EndListeningArea(BCA_LISTEN_ALWAYS, false, this);
+ return;
}
pArr->Reset();
More information about the Libreoffice-commits
mailing list