Optimize VNC screen update to reduce delays #84
Merged
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.
Previously, the VNC renderer fed the damaged region to the buffer line by line, resulting in significant rendering delays due to frequent buffer updates.
The implementation has been optimized to aggregate all updates during the current screen refresh cycle. The buffer is now updated once per refresh with the complete damaged region, reducing rendering delays and preventing screen tearing.
Previously
Screen.Recording.2024-12-24.160010.mp4
After optimizing
Screen.Recording.2024-12-24.160117.mp4
Comparing
The table compares the performance of screen updating measuring with GIFs with significant vertical variations(Selected to better illustrate the delay caused by line-by-line buffer updates) , before and after optimization, measured in average execution time (ms). Numbers in parentheses represent the standard deviation (std).
Close #81