diff options
author | Eike Rathke <erack@redhat.com> | 2016-09-21 21:42:10 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-09-22 10:04:55 +0200 |
commit | 60d0b992ea3a910be79ae4a8e8b0bb32a358b18a (patch) | |
tree | 8ae276c78dcf4bad4c056e86032960a6daa33b9a | |
parent | 5306fabfea74c01b49f96920564c7eefa91e87aa (diff) |
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
-rw-r--r-- | sc/source/core/data/document.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index da102960eb49..2d698accfb43 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(); |