perf(ui): reduce unnecessary UI-thread work#147
Open
Neutron-0 wants to merge 1 commit into
Open
Conversation
- Optimize log buffering by using a StringBuilder to avoid per‑line string allocations and rebuild only when the queue exceeds MaxUiLogLines.\n- Defer the dashboard uptime timer start and stop it when telemetry projection is disabled, eliminating unnecessary timer ticks while the dashboard is hidden.\n- Add cached fields and change‑detection logic in TrayIconService to skip UI updates when displayed values have not changed, removing redundant string interpolation and dispatcher work.\n- Remove duplicate cache‑update block to keep the code concise and avoid potential hidden bugs.
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.
This PR reduces unnecessary UI-thread work identified while investigating Issue #133.
Summary
This PR reduces unnecessary UI‑thread work while preserving existing behavior. It addresses performance concerns raised in GitHub issue #133 by tightening log handling, pausing the dashboard uptime timer when inactive, and avoiding redundant tray‑icon refreshes.
Changes
StringBuilderinMainViewModeland rebuilt the buffer only when the log line queue exceeds the UI limit.SetUptimeTimerEnabledstarts the timer when telemetry projection is enabled and stops it when disabled.TrayIconService.Behavior
No functional changes are intended. All UI elements continue to display the same information; only the amount of work performed on the UI thread is reduced.
Testing
dotnet build OmenCore.slnsucceeds with 0 warnings and 0 errors.OmenCoreApp.Tests) pass.Expected Impact
Related to #133