summaryrefslogtreecommitdiff
path: root/sc/inc/column.hxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-11-08 17:29:41 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-11-08 20:34:23 +0100
commitec0edb0969c23b25576f4d1b3b2ee5d3f21990ad (patch)
treeb3ac7b7d55455e4dc0df4cf2348988f74ca1719a /sc/inc/column.hxx
parent1a588c71a0b60d200077138eaff54fced14c4fe2 (diff)
optimize VLOOKUP by returning SharedString if possible (tdf#139444)
Profiling shows that the slowness mostly comes from converting the cell's SharedString to OUString and then the comparison converts it back. To improve performance, return the SharedString if possible and ignore the OUString. Change-Id: Idb190bd0354cea3185e5ff9ebaf92cab63f23f70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124880 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc/inc/column.hxx')
-rw-r--r--sc/inc/column.hxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index c25de8a028bc..91e5b5c3fc22 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -368,10 +368,12 @@ public:
const ScInterpreterContext* pContext = nullptr ) const
{ return GetString( GetCellValue( rBlockPos, nRow ), nRow, pContext ); }
double* GetValueCell( SCROW nRow );
- OUString GetInputString( SCROW nRow ) const
- { return GetInputString( GetCellValue( nRow ), nRow ); }
- OUString GetInputString( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const
- { return GetInputString( GetCellValue( rBlockPos, nRow ), nRow ); }
+ // Note that if pShared is set and a value is returned that way, the returned OUString is empty.
+ OUString GetInputString( SCROW nRow, const svl::SharedString** pShared = nullptr ) const
+ { return GetInputString( GetCellValue( nRow ), nRow, pShared ); }
+ OUString GetInputString( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow,
+ const svl::SharedString** pShared = nullptr ) const
+ { return GetInputString( GetCellValue( rBlockPos, nRow ), nRow, pShared ); }
double GetValue( SCROW nRow ) const;
const EditTextObject* GetEditText( SCROW nRow ) const;
void RemoveEditTextCharAttribs( SCROW nRow, const ScPatternAttr& rAttr );
@@ -747,7 +749,7 @@ private:
SCROW FindNextVisibleRow(SCROW nRow, bool bForward) const;
OUString GetString( const ScRefCellValue& cell, SCROW nRow, const ScInterpreterContext* pContext = nullptr ) const;
- OUString GetInputString( const ScRefCellValue& cell, SCROW nRow ) const;
+ OUString GetInputString( const ScRefCellValue& cell, SCROW nRow, const svl::SharedString** pShared = nullptr ) const;
/**
* Called whenever the state of cell array gets modified i.e. new cell