From 3619a5a84cf38a5233509fb2992eca5bf5893c23 Mon Sep 17 00:00:00 2001 From: skyline75489 Date: Mon, 27 Apr 2020 07:48:12 +0800 Subject: [PATCH 1/3] Improve cluster construction performance --- src/renderer/base/renderer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/renderer/base/renderer.cpp b/src/renderer/base/renderer.cpp index b974385020c..642ecb702f9 100644 --- a/src/renderer/base/renderer.cpp +++ b/src/renderer/base/renderer.cpp @@ -730,6 +730,7 @@ void Renderer::_PaintBufferOutputHelper(_In_ IRenderEngine* const pEngine, } // Walk through the text data and turn it into rendering clusters. + size_t columnCount = 0; // If we're on the first cluster to be added and it's marked as "trailing" // (a.k.a. the right half of a two column character), then we need some special handling. @@ -743,7 +744,8 @@ void Renderer::_PaintBufferOutputHelper(_In_ IRenderEngine* const pEngine, // And tell the next function to trim off the left half of it. trimLeft = true; // And add one to the number of columns we expect it to take as we insert it. - clusters.emplace_back(it->Chars(), it->Columns() + 1); + columnCount = it->Columns() + 1; + clusters.emplace_back(it->Chars(), columnCount); } else { @@ -755,11 +757,11 @@ void Renderer::_PaintBufferOutputHelper(_In_ IRenderEngine* const pEngine, // Otherwise if it's not a special case, just insert it as is. else { - clusters.emplace_back(it->Chars(), it->Columns()); + columnCount = it->Columns(); + clusters.emplace_back(it->Chars(), columnCount); } // Advance the cluster and column counts. - const auto columnCount = clusters.back().GetColumns(); it += columnCount > 0 ? columnCount : 1; // prevent infinite loop for no visible columns cols += columnCount; From 2cfe1087ccf238cbe2949f1b171f08dee54d090b Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Mon, 27 Apr 2020 08:26:06 -0700 Subject: [PATCH 2/3] Update src/renderer/base/renderer.cpp --- src/renderer/base/renderer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/renderer/base/renderer.cpp b/src/renderer/base/renderer.cpp index 642ecb702f9..cfb15dafa7b 100644 --- a/src/renderer/base/renderer.cpp +++ b/src/renderer/base/renderer.cpp @@ -730,8 +730,10 @@ void Renderer::_PaintBufferOutputHelper(_In_ IRenderEngine* const pEngine, } // Walk through the text data and turn it into rendering clusters. + // Keep the columnCount as we go to improve performance over digging it out of the vector at the end. size_t columnCount = 0; + // If we're on the first cluster to be added and it's marked as "trailing" // (a.k.a. the right half of a two column character), then we need some special handling. if (clusters.empty() && it->DbcsAttr().IsTrailing()) From e819bd76c7a2b2abb962548c9c1f7cf32782c212 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Tue, 28 Apr 2020 09:55:08 -0500 Subject: [PATCH 3/3] Update src/renderer/base/renderer.cpp --- src/renderer/base/renderer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/renderer/base/renderer.cpp b/src/renderer/base/renderer.cpp index cfb15dafa7b..5a817b28bf1 100644 --- a/src/renderer/base/renderer.cpp +++ b/src/renderer/base/renderer.cpp @@ -733,7 +733,6 @@ void Renderer::_PaintBufferOutputHelper(_In_ IRenderEngine* const pEngine, // Keep the columnCount as we go to improve performance over digging it out of the vector at the end. size_t columnCount = 0; - // If we're on the first cluster to be added and it's marked as "trailing" // (a.k.a. the right half of a two column character), then we need some special handling. if (clusters.empty() && it->DbcsAttr().IsTrailing())