diff options
author | Eike Rathke <erack@redhat.com> | 2017-06-04 00:04:10 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-06-04 00:11:34 +0200 |
commit | bb9b6cb4e6cfc5fbb4733abb8e9f5758987c197a (patch) | |
tree | 35389756d96d6c30e4ad2eb469f1ffff15b57561 /sc/inc | |
parent | a21ec27fe5d8de3455522deeedc2dc43cb41c073 (diff) |
Perf-sc: tdf#100709 avoid segment tree with ScMultiSelIter where possible
* create ScFlatBoolRowSegments in ScMultiSelIter only if necessary
* create ScMultiSelIter only for affected columns in
ScTable::MergeSelectionPattern() using ScMarkData::GetMarkedColSpans()
* obtaining a full ScRangeList in ScMarkData::GetMarkedColSpans() was
completely unnecessary, use existing selection containers instead and also
if possible avoid creating a segment tree that needs to be converted to
vector, directly use a vector instead
Improvement:
* under ScDocShell::Load()
previous: Ir: 26 454 571 612
now: Ir: 18 811 368 362
* thereof under ScTable::MergeSelectionPattern()
previous: Ir: 4 104 164 533
now: Ir: 664 738 808
Change-Id: I95895a3a000c1a0b7895fb0696b0889c6d6b4d49
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/markarr.hxx | 1 | ||||
-rw-r--r-- | sc/inc/markmulti.hxx | 12 |
2 files changed, 11 insertions, 2 deletions
diff --git a/sc/inc/markarr.hxx b/sc/inc/markarr.hxx index 33a7b9031128..548d023db4d4 100644 --- a/sc/inc/markarr.hxx +++ b/sc/inc/markarr.hxx @@ -71,6 +71,7 @@ public: ~ScMarkArrayIter(); bool Next( SCROW& rTop, SCROW& rBottom ); + void reset( const ScMarkArray* pNewArray ); }; #endif diff --git a/sc/inc/markmulti.hxx b/sc/inc/markmulti.hxx index 4999df5c5708..6ada78c243e6 100644 --- a/sc/inc/markmulti.hxx +++ b/sc/inc/markmulti.hxx @@ -63,20 +63,28 @@ public: void Clear(); void MarkAllCols( SCROW nStartRow, SCROW nEndRow ); bool HasAnyMarks() const; + + // For faster access from within ScMarkData, instead of creating + // ScMultiSelIter with ScFlatBoolRowSegments bottleneck. + const ScMarkArray& GetRowSelArray() const; + const ScMarkArray* GetMultiSelArray( SCCOL nCol ) const; }; class ScMultiSelIter { private: - ScFlatBoolRowSegments aRowSegs; + std::unique_ptr<ScFlatBoolRowSegments> pRowSegs; + ScMarkArrayIter aMarkArrayIter; SCROW nNextSegmentStart; public: ScMultiSelIter( const ScMultiSel& rMultiSel, SCCOL nCol ); ~ScMultiSelIter(); bool Next( SCROW& rTop, SCROW& rBottom ); - const ScFlatBoolRowSegments& GetRowSegments() const { return aRowSegs; } + /** Only to be used by ScMultiSel::IsAllMarked() or otherwise sure that a + segment tree is actually used. */ + bool GetRangeData( SCROW nRow, ScFlatBoolRowSegments::RangeData& rRowRange ) const; }; #endif |