Repository navigation
Addresses #5627. Skip clean runs during output flush - #5633
Merged
YourRobotOverlord merged 3 commits intoAug 22, 2026
Merged
Conversation
Avoid one cursor-position sequence per clean cell in sparse dirty rows. Refs tui-cs#5627
YourRobotOverlord
marked this pull request as draft
August 22, 2026 19:00
YourRobotOverlord
marked this pull request as ready for review
August 22, 2026 19:07
Collaborator
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves OutputBase.Write performance for sparse frames by skipping clean gaps within dirty rows, reducing cursor-position operations and console writes while preserving existing hyperlink/raster/wide-grapheme behaviors. It also adds benchmarks and regression tests to validate the new flush strategy and quantify performance changes.
Changes:
- Update
OutputBase.Writeto flush consecutive dirty-cell runs and skip clean gaps without per-cell cursor moves. - Add unit tests validating cursor-move and dirty-flag behavior for sparse and multi-run output.
- Add benchmark coverage (BenchmarkDotNet + ConPTY mode) and documentation for measuring output flush performance.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Terminal.Gui/Drivers/Output/OutputBase.cs | Implements skipping clean gaps within dirty rows and run-based cursor positioning/flush logic. |
| Tests/UnitTestsParallelizable/Drivers/Output/OutputBaseTests.cs | Adds regression tests for sparse-border and multi-run dirty output; extends test output instrumentation. |
| Tests/Benchmarks/ConsoleDrivers/OutputBuffer/OutputWriteBenchmark.cs | Introduces benchmarks for full-frame vs sparse-frame flush, plus a Windows ConPTY timing mode. |
| Tests/Benchmarks/Program.cs | Adds a CLI entry point for running the ConPTY output benchmark (output-conpty). |
| Tests/Benchmarks/README.md | Documents how to run the new output flush benchmarks, including ConPTY instructions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
wth, copilot
liuqihonggit
added a commit
to liuqihonggit/Terminal.Gui
that referenced
this pull request
Aug 26, 2026
3-way merge: #5633循环重构 + Utf8Buffer替换,解决OutputBaseTests失败
tig
pushed a commit
that referenced
this pull request
Sep 14, 2026
Utf8Buffer replaces StringBuilder to eliminate char[] to UTF8 conversion in output hot path. AnsiOutput batch mode merges pendingCursorMoves + output. BuildAnsiForRegionSkippingRasterCoveredBlanks uses Utf8Buffer. Note: needs rebase after upstream #5633 merges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Optimize
OutputBase.Writeso sparse dirty rows skip clean gaps instead of emitting one cursor-position operation per clean cell.Changes
Benchmarks
Full-frame BenchmarkDotNet performance remained effectively flat. Content writes remain unchanged at 144 for the sparse frame.
Testing
OutputBaseTests: 73 passedTo pull down this PR locally: