fix: improve keystroke performance with debounced saves#84
Open
farseenmanekhan1232 wants to merge 1 commit intofarzaa:mainfrom
Open
fix: improve keystroke performance with debounced saves#84farseenmanekhan1232 wants to merge 1 commit intofarzaa:mainfrom
farseenmanekhan1232 wants to merge 1 commit intofarzaa:mainfrom
Conversation
- Debounce text saves (500ms delay) instead of saving on every keystroke - Move file I/O to background queue to avoid blocking main thread - Add updatePreviewTextFromContent to avoid re-reading saved file - Add willResignActiveNotification handler to save when app loses focus - Remove unused saveTimer that was creating unnecessary overhead Fixes frame drops and delays reported by users during typing.
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
Users were experiencing frame drops and delays on every keystroke.
Root Cause
The app was performing synchronous disk writes on every single character typed. Each keystroke triggered:
Changes
updatePreviewTextFromContentto avoid re-reading saved filewillResignActiveNotificationhandler to save when app loses focussaveTimerthat was creating unnecessary overheadTesting
Tested locally - no more frame drops during rapid typing. Text is still reliably saved after 500ms of inactivity or when switching apps.