Optimize session loading performance by debouncing heavy UI updates#1142
Open
rainux wants to merge 1 commit intoqvacua:masterfrom
Open
Optimize session loading performance by debouncing heavy UI updates#1142rainux wants to merge 1 commit intoqvacua:masterfrom
rainux wants to merge 1 commit intoqvacua:masterfrom
Conversation
Startify session loading triggers a storm of RPC events (bufferListChanged, refreshFileBrowser, etc.) from Neovim. Previously, VimR responded to each event individually, causing excessive RPC calls (e.g., fetching all buffers) and UI updates (File Browser refresh), resulting in severe lag. This commit implements a debouncing strategy to coalesce these frequent, heavy updates: 1. Introduces `uiSyncSubject` in `MainWindow` to debounce heavy update requests with a 200ms interval. 2. Redirects `bufferListChanged`, `cwdChanged`, `bufferWritten`, `refreshFileBrowser`, and `revealCurrentBufferInFileBrowser` to this debouncer. 3. Implements `syncUiWithNvim` to perform a single, batched update of the buffer list, CWD, and File Browser state after the debounce interval. 4. Keeps `newCurrentBuffer` and `tabChanged` as direct, non-debounced updates to ensure immediate UI responsiveness (e.g., window title, tab bar) during manual interactions. This significantly improves session loading speed while maintaining a responsive UI for daily usage. Co-authored-by: Gemini <gemini@google.com>
Owner
|
Do you mean https://github.com/mhinz/vim-startify? I tried it and, afaics, only one buffer list changed event fires when I open a new window. Maybe it's something else which triggers the events? |
Contributor
Author
|
Sorry, I forgot to explain it clearly. This happens in a tab-based work flow:
Before this PR, step 4 would cause VimR to freeze for several seconds, while the original Neovim loads the same session instantly. |
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.
Startify session loading triggers a storm of RPC events (bufferListChanged, refreshFileBrowser, etc.) from Neovim. Previously, VimR responded to each event individually, causing excessive RPC calls (e.g., fetching all buffers) and UI updates (File Browser refresh), resulting in severe lag.
This commit implements a debouncing strategy to coalesce these frequent, heavy updates:
uiSyncSubjectinMainWindowto debounce heavy update requests with a 200ms interval.bufferListChanged,cwdChanged,bufferWritten,refreshFileBrowser, andrevealCurrentBufferInFileBrowserto this debouncer.syncUiWithNvimto perform a single, batched update of the buffer list, CWD, and File Browser state after the debounce interval.newCurrentBufferandtabChangedas direct, non-debounced updates to ensure immediate UI responsiveness (e.g., window title, tab bar) during manual interactions.This significantly improves session loading speed while maintaining a responsive UI for daily usage.
Implemented by Gemini CLI.