summaryrefslogtreecommitdiff
path: root/sc/source/filter/oox/sheetdatabuffer.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-16 14:47:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-16 18:19:41 +0200
commit4461e14d08c7d1c1c43b136a5a8e3acb868c0b51 (patch)
tree27c0ac91c3448af9150fce2c10169fd57d721d15 /sc/source/filter/oox/sheetdatabuffer.cxx
parenta36447215fa13f3ca92b22ac63e8164859ddb8ef (diff)
avoid a map lookup on a hot path
Change-Id: I4e514c7212c0b349796f3791b4c7f3f06d3fa22a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119064 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/filter/oox/sheetdatabuffer.cxx')
-rw-r--r--sc/source/filter/oox/sheetdatabuffer.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index e497ee44f8d8..e846d15a5b4c 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -101,11 +101,11 @@ void CellBlockBuffer::setColSpans( sal_Int32 nRow, const ValueRangeSet& rColSpan
{
OSL_ENSURE( maColSpans.count( nRow ) == 0, "CellBlockBuffer::setColSpans - multiple column spans for the same row" );
OSL_ENSURE( (mnCurrRow < nRow) && (maColSpans.empty() || (maColSpans.rbegin()->first < nRow)), "CellBlockBuffer::setColSpans - rows are unsorted" );
- if( (mnCurrRow < nRow) && (maColSpans.count( nRow ) == 0) )
- {
- maColSpans[ nRow ] = rColSpans.getRanges();
+ if( mnCurrRow >= nRow )
+ return;
+ auto pair = maColSpans.try_emplace(nRow, rColSpans.getRanges());
+ if( pair.second ) // insert happened
mnCurrRow = nRow;
- }
}
SheetDataBuffer::SheetDataBuffer( const WorksheetHelper& rHelper ) :