diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2019-06-23 21:15:18 +0530 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2019-06-26 14:21:18 +0200 |
commit | e4553dbf3d4c47c10326c9d2f0bedfe69922d3d4 (patch) | |
tree | 264c1a90c68d11698749d493ee8222719d6791d1 | |
parent | NB draw tabbed compact update context- stuff (diff) | |
download | core-e4553dbf3d4c47c10326c9d2f0bedfe69922d3d4.tar.gz core-e4553dbf3d4c47c10326c9d2f0bedfe69922d3d4.zip |
tdf#125661 : Move the delayed-grouping logic...
introduced in commit
169a1b542165f3444791fd6e672d56d3fe48bd66
avoid possible expensive repetitive formula-group
changes (tdf#102364)
to ScTable::CopyToTable() from ScDocument::CopyToDocument()
Rationale :
In tdf#125661 a delayed-grouping is needed but
ScDocument::CopyTab() is directly called which makes it
skip the delayed-grouping logic in ScDocument::CopyToDocument().
One option is to clone the delayed-grouping logic to CopyTab() too.
But doing this triggers the assert
!pDoc->IsDelayedFormulaGrouping() in
bool ScBroadcastAreaSlot::StartListeningArea()
when running the unit test testCondCopyPasteSheet() in
ucalc_condformat.cxx. This seems to be due to calling
ScTable::CopyConditionalFormat() towards the end in
ScTable::CopyToTable(). So having delayed-grouping
"block" that contains a call(s) to ScTable::CopyToTable() is
not safe. So lets move this inside ScTable::CopyToTable()
covering just the ScColumn::CopyToColumn() calls.
With this patch, sheet copy on the bug-document completes
in about 1m40s.
Change-Id: I5272f495aadab5f93f2698aba11cf2701a604c23
Reviewed-on: https://gerrit.libreoffice.org/74607
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
(cherry picked from commit 46c8ebe3d352c39bbba1a8099717fbeba384bd1a)
Reviewed-on: https://gerrit.libreoffice.org/74734
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/source/core/data/document.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 106ca902534e..3a65ae04aad7 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2110,11 +2110,6 @@ void ScDocument::CopyToDocument(const ScRange& rRange, sc::AutoCalcSwitch aACSwitch(rDestDoc, false); // avoid multiple calculations - // tdf#102364 - in some pathological cases CopyToDocument() replacing cells with new cells - // can lead to repetitive splitting and rejoining of the same formula group, which can get - // quadratically expensive with large groups. So do the grouping just once at the end. - sc::DelayFormulaGroupingSwitch delayGrouping( rDestDoc, true ); - sc::CopyToDocContext aCxt(rDestDoc); aCxt.setStartListening(false); @@ -2132,7 +2127,6 @@ void ScDocument::CopyToDocument(const ScRange& rRange, /*bGlobalNamesToLocal*/false, /*bCopyCaptions*/true); } - delayGrouping.reset(); // groups need to be updated before setting up listeners rDestDoc.StartAllListeners(aNewRange); } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 27127d42d08a..2aee672f8ad2 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1128,6 +1128,10 @@ void ScTable::CopyToTable( { InsertDeleteFlags nTempFlags( nFlags & ~InsertDeleteFlags( InsertDeleteFlags::NOTE | InsertDeleteFlags::ADDNOTES)); + // tdf#102364 - in some pathological cases CopyToTable() replacing cells with new cells + // can lead to repetitive splitting and rejoining of the same formula group, which can get + // quadratically expensive with large groups. So do the grouping just once at the end. + sc::DelayFormulaGroupingSwitch delayGrouping( *pDestTab->pDocument, true ); for (SCCOL i = nCol1; i <= ClampToAllocatedColumns(nCol2); i++) aCol[i].CopyToColumn(rCxt, nRow1, nRow2, bIsUndoDoc ? nFlags : nTempFlags, bMarked, pDestTab->CreateColumnIfNotExists(i), pMarkData, bAsLink, bGlobalNamesToLocal); |