Skip to content

Commit 829688d

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_lADOAF3p4s4Axadtzgdm49M Service-Version: 1.23
1 parent a916704 commit 829688d

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
@@ -942,12 +942,12 @@ void ROW::_resizeChars(uint16_t colEndDirty, uint16_t chBegDirty, size_t chEndDi
942942
}
943943
}
944944

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

950-
const til::small_rle<TextAttribute, uint16_t, 1>& ROW::Attributes() const noexcept
950+
const RowAttributes& ROW::Attributes() const noexcept
951951
{
952952
return _attr;
953953
}

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,
@@ -149,8 +154,8 @@ class ROW final
149154
void ReplaceText(RowWriteState& state);
150155
void CopyTextFrom(RowCopyTextFromState& state);
151156

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

0 commit comments

Comments
 (0)