perf(vscode): shard parser cache storage to fix large-workspace lag#1681
Merged
Conversation
The parser cache was persisted under a single workspaceState key, so every debounced sync serialized the entire cache (up to 10k entries, ~50MB) and shipped it over IPC to the main thread, freezing the UI on large workspaces during startup and while typing. The cache now persists to 64 bucket files under the extension storageUri. A note maps to a stable bucket via a hash of its URI and only dirty buckets are rewritten, so persistence cost is proportional to the change, not the workspace size. The legacy workspaceState blob is migrated to the new layout on first activation and removed. Pending writes are flushed on shutdown, and clear() can no longer be undone by an in-flight sync. Supersedes #1677. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
9eaf990 to
0ecba02
Compare
Addresses review findings on the sharded cache storage: - Persist migrated legacy entries before removing the workspaceState blob, so a crash during the debounce window cannot lose the cache - Don't stamp the new CACHE_VERSION when clearing the outdated cache files fails, so stale-schema buckets are never loaded as current - Remove the self-rescheduling retry in writeDirtyBuckets: a persistent write failure no longer retries (and warns) every second; dirty buckets are retried on the next sync or flush instead - Make flush() sync directly rather than flushing the debounce, so buckets dirtied only by LRU eviction are persisted too - Declare ICache.clear() as void | Promise<void> so async implementations are visible through the interface - Reuse the exported writeFile in createMatcherAndDataStore and smart-folder storage instead of duplicating it; hoist the TextEncoder - Clean up the temp storage dirs leaked by the cache spec - Run prettier over the files touched by the branch Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
@allcontributors add @ryanncode for code |
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.
The parser cache was persisted under a single workspaceState key, so every debounced sync serialized the entire cache (up to 10k entries, ~50MB) and shipped it over IPC to the main thread, freezing the UI on large workspaces during startup and while typing.
The cache now persists to 64 bucket files under the extension storageUri. A note maps to a stable bucket via a hash of its URI and only dirty buckets are rewritten, so persistence cost is proportional to the change, not the workspace size. The legacy workspaceState blob is migrated to the new layout on first activation and removed. Pending writes are flushed on shutdown, and clear() can no longer be undone by an in-flight sync.
Supersedes #1677.