ODS load perf: 7% of the time re-creating sheet name strings.
No need to create cached versions of stringified sheet tokens for a given grammar at great for every formula that we compile; defer until use. Is this a large cost on save ? Change-Id: I8058ed564dbdc00ff45c02cb483c1a20a48af272
This commit is contained in:
@@ -328,7 +328,9 @@ private:
|
|||||||
bool mbCloseBrackets; // whether to close open brackets automatically, default TRUE
|
bool mbCloseBrackets; // whether to close open brackets automatically, default TRUE
|
||||||
bool mbRewind; // whether symbol is to be rewound to some step during lexical analysis
|
bool mbRewind; // whether symbol is to be rewound to some step during lexical analysis
|
||||||
std::vector<sal_uInt16> maExternalFiles;
|
std::vector<sal_uInt16> maExternalFiles;
|
||||||
std::vector<OUString> maTabNames;
|
|
||||||
|
std::vector<OUString> maTabNames; /// sheet names mangled for the current grammer for output
|
||||||
|
std::vector<OUString> &GetSetupTabNames() const; /// get or setup tab names for the current grammar
|
||||||
|
|
||||||
bool NextNewToken(bool bInArray = false);
|
bool NextNewToken(bool bInArray = false);
|
||||||
|
|
||||||
|
@@ -228,14 +228,24 @@ void ScCompiler::SetGrammar( const FormulaGrammar::Grammar eGrammar )
|
|||||||
if (eMyGrammar != GetGrammar())
|
if (eMyGrammar != GetGrammar())
|
||||||
SetGrammarAndRefConvention( eMyGrammar, eOldGrammar);
|
SetGrammarAndRefConvention( eMyGrammar, eOldGrammar);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pDoc && maTabNames.empty())
|
// Unclear how this was intended to be refreshed when the
|
||||||
|
// grammer or sheet count is changed ? Ideally this would be
|
||||||
|
// a method on Document that would globally cache these.
|
||||||
|
std::vector<OUString> &ScCompiler::GetSetupTabNames() const
|
||||||
|
{
|
||||||
|
std::vector<OUString> &rTabNames = const_cast<ScCompiler *>(this)->maTabNames;
|
||||||
|
|
||||||
|
if (pDoc && rTabNames.empty())
|
||||||
{
|
{
|
||||||
maTabNames = pDoc->GetAllTableNames();
|
rTabNames = pDoc->GetAllTableNames();
|
||||||
std::vector<OUString>::iterator it = maTabNames.begin(), itEnd = maTabNames.end();
|
std::vector<OUString>::iterator it = rTabNames.begin(), itEnd = rTabNames.end();
|
||||||
for (; it != itEnd; ++it)
|
for (; it != itEnd; ++it)
|
||||||
ScCompiler::CheckTabQuotes(*it, formula::FormulaGrammar::extractRefConvention(meGrammar));
|
ScCompiler::CheckTabQuotes(*it, formula::FormulaGrammar::extractRefConvention(meGrammar));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return rTabNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScCompiler::SetNumberFormatter( SvNumberFormatter* pFormatter )
|
void ScCompiler::SetNumberFormatter( SvNumberFormatter* pFormatter )
|
||||||
@@ -4207,17 +4217,20 @@ void ScCompiler::CreateStringFromSingleRef(OUStringBuffer& rBuffer,FormulaToken*
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
rBuffer.append(ScGlobal::GetRscString(STR_NO_NAME_REF));
|
rBuffer.append(ScGlobal::GetRscString(STR_NO_NAME_REF));
|
||||||
pConv->makeRefStr(rBuffer, meGrammar, aPos, aErrRef, maTabNames, aRef, true);
|
pConv->makeRefStr(rBuffer, meGrammar, aPos, aErrRef,
|
||||||
|
GetSetupTabNames(), aRef, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pConv->makeRefStr(rBuffer, meGrammar, aPos, aErrRef, maTabNames, aRef, true);
|
pConv->makeRefStr(rBuffer, meGrammar, aPos, aErrRef,
|
||||||
|
GetSetupTabNames(), aRef, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScCompiler::CreateStringFromDoubleRef(OUStringBuffer& rBuffer,FormulaToken* _pTokenP) const
|
void ScCompiler::CreateStringFromDoubleRef(OUStringBuffer& rBuffer,FormulaToken* _pTokenP) const
|
||||||
{
|
{
|
||||||
OUString aErrRef = GetCurrentOpCodeMap()->getSymbol(ocErrRef);
|
OUString aErrRef = GetCurrentOpCodeMap()->getSymbol(ocErrRef);
|
||||||
pConv->makeRefStr(rBuffer, meGrammar, aPos, aErrRef, maTabNames, static_cast<ScToken*>(_pTokenP)->GetDoubleRef(), false);
|
pConv->makeRefStr(rBuffer, meGrammar, aPos, aErrRef, GetSetupTabNames(),
|
||||||
|
static_cast<ScToken*>(_pTokenP)->GetDoubleRef(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScCompiler::CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* _pTokenP) const
|
void ScCompiler::CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* _pTokenP) const
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
Reference in New Issue
Block a user