fix(windows): prevent working set trimming and reduce default log level#192
Open
richardpowellus wants to merge 3 commits intoOpenBubbles:rustpushfrom
Open
Conversation
On Windows, the ~400-500MB working set gets paged out when the app loses focus. When focus returns, the OS spends 10-15 seconds faulting pages back into RAM, causing severe input lag. This happens even on high-end hardware. Fixes: - Call SetProcessWorkingSetSizeEx() at startup with a 256MB hard minimum floor to prevent Windows from trimming the working set on focus loss - Set process priority to ABOVE_NORMAL to reduce scheduling latency - Default logLevel to WARNING on desktop platforms (was INFO, which logs every keystroke and text prediction annotation, generating tens of MB of log I/O per session) Closes OpenBubbles#191
- Upgrade freezed_annotation to ^3.0.0 (from ^2.4.1) - Upgrade freezed to ^3.1.0 (from ^2.4.1) - Remove build_verify (incompatible with Flutter 3.41 test_api) - Update material_color_utilities override to ^0.12.0 - Add dependency overrides for pointycastle, source_gen, dart_style to resolve freezed 3.x vs objectbox_generator conflicts
aa1a72d to
2383248
Compare
- Updated skeletonizer ^1.4.3 -> ^2.1.3 (Flutter 3.41 Canvas compat) - Updated google_fonts ^6.2.2 -> ^8.0.2 (Dart 3.11 compat) - Updated pubspec.lock and generated plugin registrants
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
Fixes severe input lag (~15 seconds) on Windows when the app regains focus after being in the background. Also reduces excessive disk I/O from keystroke logging on desktop.
Closes #191
Problem
On Windows, the ~400-500MB working set gets paged out when the app loses focus. When focus returns, the OS spends 10-15 seconds faulting all those pages back into RAM before the app becomes responsive. This happens even on high-end hardware (tested on RTX 3080 Ti, 64GB RAM, NVMe SSD).
Additionally, the default
logLevelis INFO, which logs every single keystroke and text prediction annotation to disk. Typing a single word produces 8+ log entries. This generates tens of MB of log I/O per session, adding constant disk pressure.Changes
windows/runner/main.cppSetProcessWorkingSetSizeEx()at startup with a 256 MB hard minimum floor (QUOTA_LIMITS_HARDWS_MIN_ENABLE). This prevents Windows from trimming the working set when the app loses focus, eliminating the 10-15 second input lag on focus regain.ABOVE_NORMAL_PRIORITY_CLASSto reduce scheduling latency for the UI thread.lib/database/global/settings.dartlogLeveltoLevel.warningon desktop platforms (Windows, Linux, macOS). Mobile continues to default toLevel.info. Users can still change this in Settings > Troubleshooting.Testing
Tested on Windows 11 with:
Before fix: 10-15 seconds of input lag every time the window regains focus.
After fix: Immediate responsiveness on focus regain, no perceptible lag.