Kaydet (Commit) 99f09638 authored tarafından Michael Meeks's avatar Michael Meeks

ODS load perf: don't allocate temporary strings un-necessarily

Of the 53bn cycles consumed loading a large test; this saves up to
30bn parsing tab names, plus ~1bn not copying strings to convert to
integers.

Change-Id: Ie768ff8c2159dec62418088e643fe468e4cd5d70
üst f98b534e
...@@ -1015,6 +1015,7 @@ static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r, ...@@ -1015,6 +1015,7 @@ static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r,
} }
/** /**
@param p pointer to null-terminated sal_Unicode string
@param pRange pointer to range where rAddr effectively is *pRange->aEnd, @param pRange pointer to range where rAddr effectively is *pRange->aEnd,
used in conjunction with pExtInfo to determine the tab span used in conjunction with pExtInfo to determine the tab span
of a 3D reference. of a 3D reference.
...@@ -1023,7 +1024,7 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo ...@@ -1023,7 +1024,7 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo
ScAddress::ExternalInfo* pExtInfo = NULL, ScRange* pRange = NULL ) ScAddress::ExternalInfo* pExtInfo = NULL, ScRange* pRange = NULL )
{ {
sal_uInt16 nRes = 0; sal_uInt16 nRes = 0;
OUString aDocName; // der pure Dokumentenname OUString aDocName; // the pure Document Name
OUString aTab; OUString aTab;
bool bExtDoc = false; bool bExtDoc = false;
bool bExtDocInherited = false; bool bExtDocInherited = false;
...@@ -1072,6 +1073,7 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo ...@@ -1072,6 +1073,7 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo
} }
else else
{ {
OUStringBuffer aTabAcc;
while (*p) while (*p)
{ {
if( *p == '.') if( *p == '.')
...@@ -1081,9 +1083,10 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo ...@@ -1081,9 +1083,10 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo
{ {
p++; break; p++; break;
} }
aTab += OUString(*p); aTabAcc.append(*p);
p++; p++;
} }
aTab = aTabAcc.makeStringAndClear();
} }
if( *p++ != '.' ) if( *p++ != '.' )
nBits = 0; nBits = 0;
...@@ -1148,8 +1151,7 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo ...@@ -1148,8 +1151,7 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo
} }
else else
{ {
OUString aTmp( p ); long n = rtl_ustr_toInt32( p, 10 ) - 1;
long n = aTmp.toInt32() - 1;
while (rtl::isAsciiDigit( *p )) while (rtl::isAsciiDigit( *p ))
p++; p++;
if( n < 0 || n > MAXROW ) if( n < 0 || n > MAXROW )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment