Skip to content

Commit f259e20

Browse files
lheckerDHowett
authored andcommitted
Fix a output marks performance regression (#19242)
An alternative approach for #18291. Improves perf by ~7%. (cherry picked from commit 6b19d21) Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgdm49Y Service-Version: 1.22
1 parent 22af773 commit f259e20

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/buffer/out/Row.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,12 +937,12 @@ void ROW::_resizeChars(uint16_t colEndDirty, uint16_t chBegDirty, size_t chEndDi
937937
}
938938
}
939939

940-
til::small_rle<TextAttribute, uint16_t, 1>& ROW::Attributes() noexcept
940+
RowAttributes& ROW::Attributes() noexcept
941941
{
942942
return _attr;
943943
}
944944

945-
const til::small_rle<TextAttribute, uint16_t, 1>& ROW::Attributes() const noexcept
945+
const RowAttributes& ROW::Attributes() const noexcept
946946
{
947947
return _attr;
948948
}

src/buffer/out/Row.hpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
class ROW;
1515
class TextBuffer;
1616

17+
// Because MarkKind::Output gets set only on the actually written text,
18+
// most rows will end up having at least 2 runs: The start of the line
19+
// with MarkKind::Output and the rest of the line with MarkKind::None.
20+
using RowAttributes = til::small_rle<TextAttribute, uint16_t, 2>;
21+
1722
enum class DelimiterClass
1823
{
1924
ControlChar,
@@ -148,8 +153,8 @@ class ROW final
148153
void ReplaceText(RowWriteState& state);
149154
void CopyTextFrom(RowCopyTextFromState& state);
150155

151-
til::small_rle<TextAttribute, uint16_t, 1>& Attributes() noexcept;
152-
const til::small_rle<TextAttribute, uint16_t, 1>& Attributes() const noexcept;
156+
RowAttributes& Attributes() noexcept;
157+
const RowAttributes& Attributes() const noexcept;
153158
TextAttribute GetAttrByColumn(til::CoordType column) const;
154159
std::vector<uint16_t> GetHyperlinks() const;
155160
ImageSlice* SetImageSlice(ImageSlice::Pointer imageSlice) noexcept;
@@ -297,7 +302,7 @@ class ROW final
297302
std::span<uint16_t> _charOffsets;
298303
// _attr is a run-length-encoded vector of TextAttribute with a decompressed
299304
// length equal to _columnCount (= 1 TextAttribute per column).
300-
til::small_rle<TextAttribute, uint16_t, 1> _attr;
305+
RowAttributes _attr;
301306
// The width of the row in visual columns.
302307
uint16_t _columnCount = 0;
303308
// Stores double-width/height (DECSWL/DECDWL/DECDHL) attributes.

0 commit comments

Comments
 (0)