summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorsopy <contact@sopy.one>2024-09-28 14:29:54 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-02 09:30:23 +0200
commit10ed0fe1807b95979c1c4204734723c6211c9932 (patch)
treed31221d703f0dd7b9a6be7a2662ddf73c1387852 /sc
parent025e089c08c1224b3bf4e7f21786b828a4c26d4f (diff)
perf: improve ScFlatUInt16RowSegments::dumpAsString()
Change-Id: Ie4db90ae6e7a40824ad082606e4573e74956fdd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174142 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins Reviewed-by: vivek javiya <vivek.javiya@collabora.com> (cherry picked from commit 6d949b587b192ca572c187c1131e2a8947269337) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174326 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/segmenttree.cxx34
1 files changed, 12 insertions, 22 deletions
diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx
index aa10d32544cb..e57724e61eda 100644
--- a/sc/source/core/data/segmenttree.cxx
+++ b/sc/source/core/data/segmenttree.cxx
@@ -25,6 +25,7 @@
#include <limits>
#include <string_view>
#include <global.hxx>
+#include <rtl/strbuf.hxx>
using ::std::numeric_limits;
@@ -492,23 +493,19 @@ void ScFlatBoolRowSegments::makeReady()
OString ScFlatBoolRowSegments::dumpAsString()
{
- OString aOutput;
- OString aSegment;
+ OStringBuffer aOutput(4096);
RangeData aRange;
SCROW nRow = 0;
while (getRangeData(nRow, aRange))
{
if (!nRow)
- aSegment = (aRange.mbValue ? std::string_view("1") : std::string_view("0")) + OString::Concat(":");
- else
- aSegment.clear();
+ aOutput.append(aRange.mbValue ? '1' : '0').append(':');
- aSegment += OString::number(aRange.mnRow2) + " ";
- aOutput += aSegment;
+ aOutput.append(OString::number(aRange.mnRow2) + " ");
nRow = aRange.mnRow2 + 1;
}
- return aOutput;
+ return aOutput.makeStringAndClear();
}
ScFlatBoolColSegments::ScFlatBoolColSegments(SCCOL nMaxCol) :
@@ -564,23 +561,19 @@ void ScFlatBoolColSegments::makeReady()
OString ScFlatBoolColSegments::dumpAsString()
{
- OString aOutput;
- OString aSegment;
+ OStringBuffer aOutput(4096);
RangeData aRange;
SCCOL nCol = 0;
while (getRangeData(nCol, aRange))
{
if (!nCol)
- aSegment = (aRange.mbValue ? OString::Concat("1") : OString::Concat("0")) + OString::Concat(":");
- else
- aSegment.clear();
+ aOutput.append(aRange.mbValue ? '1' : '0').append(':');
- aSegment += OString::number(aRange.mnCol2) + " ";
- aOutput += aSegment;
+ aOutput.append(OString::number(aRange.mnCol2) + " ");
nCol = aRange.mnCol2 + 1;
}
- return aOutput;
+ return aOutput.makeStringAndClear();
}
ScFlatUInt16RowSegments::ForwardIterator::ForwardIterator(ScFlatUInt16RowSegments& rSegs) :
@@ -693,19 +686,16 @@ void ScFlatUInt16RowSegments::makeReady()
OString ScFlatUInt16RowSegments::dumpAsString()
{
- OString aOutput;
- OString aSegment;
+ OStringBuffer aOutput(4096);
RangeData aRange;
SCROW nRow = 0;
while (getRangeData(nRow, aRange))
{
- aSegment = OString::number(aRange.mnValue) + ":" +
- OString::number(aRange.mnRow2) + " ";
- aOutput += aSegment;
+ aOutput.append(OString::number(aRange.mnValue) + ":" + OString::number(aRange.mnRow2) + " ");
nRow = aRange.mnRow2 + 1;
}
- return aOutput;
+ return aOutput.makeStringAndClear();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */