Fix excessive screen updates in progress indicators#14206
Merged
Conversation
Only update progress display when file size actually changes, preventing unnecessary screen redraws and reducing CPU/GPU overhead. Co-authored-by: benhillis <17727402+benhillis@users.noreply.github.com>
Co-authored-by: benhillis <17727402+benhillis@users.noreply.github.com>
Co-authored-by: benhillis <17727402+benhillis@users.noreply.github.com>
Co-authored-by: benhillis <17727402+benhillis@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix excessive screen updates during wsl export
Fix excessive screen updates in wsl --export progress indicator
Feb 12, 2026
benhillis
requested changes
Feb 12, 2026
Co-authored-by: benhillis <17727402+benhillis@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets the wsl --export console progress indicator to reduce unnecessary redraws (and associated CPU/GPU usage + flicker) by skipping UpdateProgress() calls when the file size hasn’t changed.
Changes:
- Add local state in
HandleConsoleProgressBar::UpdateFileSize()to track the previous file size. - Only call
ConsoleProgressIndicator::UpdateProgress()when the current size differs from the previous value.
When file size grows in sub-MB increments, comparing raw bytes causes redraws even though the displayed MB value hasn't changed. Now we calculate and compare the MB value directly, ensuring the progress indicator only updates when the displayed value actually changes. Also initialize previousSizeMB to -1 to ensure initial progress is always shown (even when starting at 0 MB). Co-authored-by: benhillis <17727402+benhillis@users.noreply.github.com>
Move the duplicate string check into ConsoleProgressIndicator::UpdateProgress() itself. This provides a more general solution that prevents printing the same string twice for any caller, not just the file size case. The comparison now happens at the string level, which handles all formatting variations and makes the fix more maintainable. Co-authored-by: benhillis <17727402+benhillis@users.noreply.github.com>
Copilot
AI
changed the title
Fix excessive screen updates in wsl --export progress indicator
Fix excessive screen updates in progress indicators
Feb 12, 2026
benhillis
approved these changes
Feb 12, 2026
OneBlue
approved these changes
Feb 12, 2026
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 of the Pull Request
Progress indicators were redrawing every 100ms regardless of whether the displayed value changed, causing screen flickering and unnecessary CPU/GPU overhead. This updates the draw logic in
ConsoleProgressIndicatorto cache the formatted string and only redraw when the displayed text actually changes.PR Checklist
Detailed Description of the Pull Request / Additional comments
The Issue
Progress indicators like those used in
wsl --exportpoll every 100ms and unconditionally callUpdateProgress(), which erases and redraws the progress text. When the displayed value hasn't changed between polls, this causes:For example, with file size displays, if a file grew in sub-MB increments (e.g., from 1.1 MB to 1.9 MB), the progress would redraw multiple times even though the displayed value "(1 MB)" hadn't changed.
The Fix
Implemented string caching in
ConsoleProgressIndicator::UpdateProgress()to compare the new progress message with the previously displayed one:Key improvements:
UpdateProgress(), not just file size displaysHandleConsoleProgressBar::UpdateFileSize()and other callers remain simple and don't need their own caching logicValidation Steps Performed
Requires manual testing on Windows:
wsl --export <distro> output.tar.xz --format tar.xzOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.