summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2019-10-17 20:33:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-11-03 17:11:32 +0100
commit48101a1a0d574db3db1f99c782bd67e885b232bb (patch)
treeafd2f88944d73f43762b3a31df2ff81c8115ba9e /sc
parentab285c743afa1c8769581871d7b56374fd8c49f1 (diff)
size some stringbuffer to prevent re-alloc
I started with 32 and kept doubling the size until the site did not need re-alloc, but clamped it at 512. Change-Id: I55fe36b31cd3d40f86e5729337a927cf920f2af6 Reviewed-on: https://gerrit.libreoffice.org/81960 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/calcconfig.cxx2
-rw-r--r--sc/source/core/tool/userlist.cxx4
-rw-r--r--sc/source/filter/excel/xipage.cxx10
-rw-r--r--sc/source/filter/excel/xistream.cxx2
-rw-r--r--sc/source/filter/xml/xmlcelli.hxx2
5 files changed, 9 insertions, 11 deletions
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 6bafa226e8b5..9f9bf35bacc0 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -193,7 +193,7 @@ bool ScCalcConfig::operator!= (const ScCalcConfig& r) const
OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes)
{
- OUStringBuffer result;
+ OUStringBuffer result(256);
formula::FormulaCompiler aCompiler;
formula::FormulaCompiler::OpCodeMapPtr pOpCodeMap(aCompiler.GetOpCodeMap(css::sheet::FormulaLanguage::ENGLISH));
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index 96e6983ac712..60d6a163ec60 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -212,7 +212,7 @@ ScUserList::ScUserList()
xCal = rCalendar.Days;
if ( xCal.hasElements() )
{
- OUStringBuffer aDayShortBuf, aDayLongBuf;
+ OUStringBuffer aDayShortBuf(32), aDayLongBuf(64);
sal_Int32 i;
sal_Int32 nLen = xCal.getLength();
sal_Int16 nStart = sal::static_int_cast<sal_Int16>(nLen);
@@ -244,7 +244,7 @@ ScUserList::ScUserList()
xCal = rCalendar.Months;
if ( xCal.hasElements() )
{
- OUStringBuffer aMonthShortBuf, aMonthLongBuf;
+ OUStringBuffer aMonthShortBuf(128), aMonthLongBuf(128);
sal_Int32 i;
sal_Int32 nLen = xCal.getLength() - 1;
for (i = 0; i < nLen; i++)
diff --git a/sc/source/filter/excel/xipage.cxx b/sc/source/filter/excel/xipage.cxx
index 29110f79b363..db8f4377a1c2 100644
--- a/sc/source/filter/excel/xipage.cxx
+++ b/sc/source/filter/excel/xipage.cxx
@@ -224,17 +224,15 @@ void XclImpPageSettings::Finalize()
// *** create page style sheet ***
- OUStringBuffer aStyleName;
- aStyleName.append("PageStyle_");
-
+ OUString aStyleName;
OUString aTableName;
if( GetDoc().GetName( nScTab, aTableName ) )
- aStyleName.append(aTableName);
+ aStyleName = "PageStyle_" + aTableName;
else
- aStyleName.append(static_cast<sal_Int32>(nScTab+1));
+ aStyleName = "PageStyle_" + OUString::number(static_cast<sal_Int32>(nScTab+1));
ScStyleSheet& rStyleSheet = ScfTools::MakePageStyleSheet(
- GetStyleSheetPool(), aStyleName.makeStringAndClear(), false);
+ GetStyleSheetPool(), aStyleName, false);
SfxItemSet& rItemSet = rStyleSheet.GetItemSet();
diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx
index 8e48027cdf1b..f7427b9295ed 100644
--- a/sc/source/filter/excel/xistream.cxx
+++ b/sc/source/filter/excel/xistream.cxx
@@ -831,7 +831,7 @@ std::size_t XclImpStream::ReadUniStringExtHeader( bool& rb16Bit, sal_uInt8 nFlag
OUString XclImpStream::ReadRawUniString( sal_uInt16 nChars, bool b16Bit )
{
- OUStringBuffer aRet;
+ OUStringBuffer aRet(nChars);
sal_uInt16 nCharsLeft = nChars;
sal_uInt16 nReadSize;
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index d80cfa759619..10aeb2dda44a 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -68,7 +68,7 @@ class ScXMLTableRowCellContext : public ScXMLImportContext
boost::optional<OUString> maFirstParagraph; /// unformatted first paragraph, for better performance.
ScEditEngineDefaulter* mpEditEngine;
- OUStringBuffer maParagraph;
+ OUStringBuffer maParagraph{32};
sal_Int32 mnCurParagraph;
ParaFormatsType maFormats;