Improve settings window load performance#145
Merged
Merged
Conversation
…ent white flash" This reverts commit 4ac79af.
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.
Problem
Since the recent settings-page additions (#140, #142) and the dark retheme (#138), opening the settings window felt slow, flashed a white rectangle before the dark content appeared, and visibly jumped to the saved scroll position after rendering.
Profiling with instrumented harnesses (clock running, pixel-sampling the screen during open) attributed it to three independent causes:
TimeZoneInfo.GetSystemTimeZones()+ system font enumeration running synchronously in the viewmodel constructor.Ruled out along the way: no individual control is heavy (30 chip buttons ≈ 13 ms; all checkboxes/textboxes/combos/sliders combined ≈ 50 ms cold across the 845-element tree), card drop shadows ≈ 0 ms, and deferring all below-fold sections saves only ~50 ms because ~125 ms is fixed window-materialization + XAML parse cost.
Fix (one commit each)
WM_ERASEBKGNDand fills the client area with the palette'sWindowBackgroundBrushcolor via GDI, which lands before WPF's first frame. The color is read at message time, so dark/light/high-contrast and live theme switches all behave, and it also covers regions exposed during resizes.Measured (screen pixel sampling at the window center during open, Debug)
#FFFFFF, holds solid white ~55 ms#202020(theme background)The open now reads as: themed window fades in, content appears once in its final position, nothing shifts. No window lifecycle changes or DWM tricks.