summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-05-19 20:23:07 +0100
committerMichael Meeks <michael.meeks@collabora.com>2014-05-21 10:03:36 +0100
commitc07b8dedf7b1d0ddb2c97368e1634432974632db (patch)
tree52b64755d9ff981373d6406652652dce583e9178 /formula
parent7732f806dfcc9375757e7ccbe1ca3c1d194af266 (diff)
ODS load perf: transfer ownership of the ScTokenArray to save cycles.
Add API to wnsure we don't end up allocating 32k bytes of tokens for each ScFormulaToken, as happens when you Add a token to a new empty ScTokenArray. Change-Id: Ib12a3065eb513243a2146ebb009fbaa650385dd9
Diffstat (limited to 'formula')
-rw-r--r--formula/source/core/api/token.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index c5d7da7ee28c..30b0e162d97c 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -687,6 +687,24 @@ void FormulaTokenArray::Assign( const FormulaTokenArray& r )
}
}
+/// Optimisiation for efficiently creating StringXML placeholders
+void FormulaTokenArray::Assign( sal_uInt16 nCode, FormulaToken **pTokens )
+{
+ assert( nLen = 0 );
+ assert( pCode == NULL );
+
+ nLen = nCode;
+ pCode = new FormulaToken*[ nLen ];
+
+ for( sal_uInt16 i = 0; i < nLen; i++ )
+ {
+ FormulaToken *t = pTokens[ i ];
+ assert( t->GetOpCode() == ocStringXML );
+ pCode[ i ] = t;
+ t->IncRef();
+ }
+}
+
FormulaTokenArray& FormulaTokenArray::operator=( const FormulaTokenArray& rArr )
{
Clear();