Eight Windows Terminal Proposals Target Overhead in Rendering and Text Processing
Eight performance proposals were submitted for Microsoft's Windows Terminal, which hosts shells such as PowerShell and Command Prompt. One proposal targets how the terminal signals that the screen needs to be redrawn.
Windows Terminal was waking the render thread for nearly every line of text or cursor movement. An analysis of typical text output found that this notification path accounted for about 9% of the output thread's processing time.
If the redraw flag is already set, another notification is redundant. The proposal notifies the render thread only when the flag changes from unset to set. The render thread checks the flag before going idle, so it does not go to sleep while a redraw is pending.
Before trying to draw characters faster, it is worth finding out how much time the terminal spends asking for a redraw in the first place. That is an interesting angle on terminal performance.
Faster ASCII and text attribute processing
A proposal for ASCII characters, including letters and digits, uses the CPU's SSE2 instructions. It replaces checks on individual code units with checks on eight at a time. When the entire batch is ASCII, it also writes the position data in bulk. Blocks containing non-ASCII characters use the existing path.
Displaying text also means tracking attributes such as color. Another proposal changes how the terminal handles runs of characters with the same attributes. On lines where attributes change at each character, the existing implementation searches from the first run on every update. The work can therefore grow with the square of the number of runs.
The proposal handles an update directly from the last run when the destination is already in that run. A benchmark of this change alone, using output with SGR control sequences that change attributes such as text color, showed 9.2% higher throughput and 7.4% less CPU time per unit of data.
Another proposal changes how the terminal parses control sequences. When it sees the start of a CSI control sequence, which can set text color or cursor position, it switches parser state directly without parsing the first two characters separately. The shortcut applies only to ANSI output when tracing is disabled.
Displaying a large volume of text and frequently changing text color or cursor position put pressure on different parts of the terminal. Character count alone cannot explain where the processing time goes.
Changes to scrolling and tracing
When scrolling rotates the buffer, the terminal runs hyperlink cleanup even when there are no hyperlinks. A proposal to skip that work also resets pattern data only when it contains intervals.
A change to parser tracing would skip additional logging work when tracing is off. A reviewer asked for further investigation into why the change improves performance.
Another proposal changes how the terminal swaps the small variable-length arrays that hold text attributes during scrolling. The existing code performs three moves through a temporary object. A dedicated swap would handle each storage case differently, for example by swapping pointers for heap-allocated data.
Benchmarks of the swap change alone found no statistically significant speedup for sustained output or scroll-region operations. Removing work from the code does not tell you how much faster the terminal gets. That requires a measurement.
Output benchmarks show different gains
The developers published results with all eight changes applied. They compared x64 release builds without profile-guided optimization (PGO) in a Hyper-V virtual machine using WARP software rendering in place of a GPU. The figures below are medians. Data volumes are measured in MiB (1 MiB is 1,024 × 1,024 bytes).
Sustained output rose from 21.35 MiB/s to 25.01 MiB/s, a 17.1% gain. Combined CPU time for WindowsTerminal and OpenConsole fell from 115.3 ms to 99.0 ms per MiB, a 14.1% reduction.
ASCII output increased from 75.93 MiB/s to 84.18 MiB/s, a gain of 10.9%. Output with SGR control sequences rose 8.4%, from 32.55 MiB/s to 35.27 MiB/s. Output containing URLs rose 16.3%, from 103.78 MiB/s to 120.73 MiB/s.
The Unicode benchmark moved from 43.12 MiB/s to 43.46 MiB/s, a difference of 0.8% with no statistically significant speedup. The SSE2 path still falls back to the existing implementation for blocks with non-ASCII characters, an example of why results can vary with the types of characters in the output.
Windows Terminal output performance with all eight proposals applied
| Output type | Throughput (MiB/s) | CPU time (ms/MiB) |
|---|---|---|
| Before → after all eight changes (medians) Hyper-V virtual machine with WARP software rendering x64 release build without PGO Combined CPU time for WindowsTerminal and OpenConsole 1 MiB = 1,024 × 1,024 bytes | ||
| Sustained output | 21.35→ +17.1% | 115.3→ −14.1% |
| ASCII characters | 75.93→ +10.9% | 30.30→ −12.6% |
| Text color (SGR) | 32.55→ +8.4% | 83.84→ −10.4% |
| URL output | 103.78→ +16.3% | 32.47→ −15.0% |
| Unicode characters No significant difference found | 43.12→ +0.8% | 54.93→ −2.6% |
| Cursor movement No significant difference found | 26.08→ +4.0% | 100.95→ −5.6% |
| Scroll region | 27.70→ +3.7% | 91.31→ −3.9% |
Sustained output and the scroll-region benchmark met preset thresholds for both throughput and CPU time, indicating that neither metric regressed beyond the acceptable margin. No median was worse in any benchmark, but the other tests did not establish that both thresholds were met.
The developers' results point to possible gains when printing large volumes of output, such as logs. The effects with GPU rendering or output containing substantial amounts of Japanese text would need separate measurement.
Faster keyboard input and remaining design questions
A proposal for console input changes how the console buffers input before it is read. Previously, each read removed consumed data from the front of the queue. The proposal uses an array and a read position, compacting the array only when it needs more room.
Eight Windows Terminal performance proposals
| Area | Existing behavior | Proposed change |
|---|---|---|
| Render notifications | Lines and cursor movement Trigger frequent notifications | Notify when the redraw flag Changes from unset to set |
| ASCII characters | Check one code unit at a time | Check eight code units at once with SSE2 Write position data in bulk |
| Text attributes | Scan from the first run each time | If the update is in the last run Start with that run |
| Control sequences | Parse the first two characters separately | For ANSI output with tracing off Switch parser state directly |
| Links and patterns | Clean up or reset even when empty | Skip cleanup when there are no links Reset pattern data only When intervals are present |
| Parser tracing | Extra work even when disabled | Skip extra work when disabled |
| Swapping attributes | Three moves through a temporary object | Swap based on how data is stored |
| Keyboard input | Remove from the front on every read | Advance the read position Compact when space runs low |
With all eight changes applied, the median time to read 4,096 key input records from OpenConsole fell from 156.7 microseconds to 130.1 microseconds.
Reviewers suggested avoiding compaction altogether with a structure such as a ring buffer. They also discussed freeing memory when the queue shrinks substantially, handling Unicode strings, and maintaining compatibility with existing console APIs.
As of November 27, all eight changes were public as unmerged proposals, with adoption in a stable release still unconfirmed.
Send fewer duplicate redraw notifications. Search fewer runs for the right text attributes. Stop deleting consumed input on every read. Looking behind the text that flows across the screen reveals the work developers do to make a terminal faster.
KioskNews shows a cleaned-up reading view extracted from the publisher’s page — the original always lives on their site, not ours.
