perf: reduce memory usage by ~80-130 MB per connection#232
Merged
Conversation
- Eliminate dedicated ping driver, use main driver for health checks (~30-50 MB/connection) - Lazy-load plugin bundles on first use instead of at startup (~20-30 MB saved) - Evict inactive native window-tab row data after 5s, re-fetch on focus - Clear InMemoryRowProvider cache when RowBuffer is evicted - Remove duplicate sourceQuery string from RowBuffer - Add MEMORY-AUDIT.md with findings and fix tracking
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…e, consolidate event monitors
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
Implements 8 memory/CPU optimizations identified in the memory audit (see
docs/development/MEMORY-AUDIT.md):bundle.load()is deferred until the first driver request or settings screen visitNSWindow.didResignKeyNotification, re-fetched on focusRowBuffer.sourceQuery(<500 KB per tab): Eliminated duplicate query string; rehydration reads fromtab.querydirectlyRowBufferdirectly instead of copying rows; sorted views store index permutation instead of reordered row arraysAlso clears
InMemoryRowProvidercache whenRowBufferis evicted, fixing a bug where eviction freedRowBuffer.rowsbut the provider still held its own copy.Files changed
ConnectionSession.swift— removedmetadataDriverpropertyDatabaseManager.swift— removed ping driver, metadata driver,ensureMetadataDriver,metadataCreationTasks; health checks use main driverPluginManager.swift— splitloadAllPluginsintodiscoverPlugins+loadPendingPluginsDatabaseDriver.swift— triggerloadPendingPlugins()on first driver creationRowProvider.swift—InMemoryRowProviderholdsRowBufferreference + optionalsortIndicesMainEditorContentView.swift—makeRowProvider()passesrowBuffer+ sort indicesMainContentCoordinator.swift— Phase 2 metadata uses main driver;evictInactiveRowData()methodMainContentCoordinator+Navigation.swift— removed all 8 metadata driver sync blocksSQLEditorCoordinator.swift— filter notifications by editor's own windowQueryTab.swift— removedRowBuffer.sourceQueryExportDialog.swift,InstalledPluginsView.swift— trigger lazy plugin load on appearTest plan