Optimize / Storage migrations#2491
Merged
Merged
Conversation
superKalo
approved these changes
Jun 17, 2026
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.
Optimize storage migration sweep
StorageControllerran 20 migrations on every boot, and sinceget/set/removeall block on that sweep, it held up app load (especially on mobile, where each storage call is a postMessage round-trip to native RN storage).Each migration re-read
passedMigrationsand read its data keys before checking whether it had already run. In the steady state (returning user, everything already migrated) this meant ~41 reads + ~3 writes on every single launch.Changes
passedMigrationsonce into an in-memorySet; every migration now checks it first and returns before touching storage.passedMigrationsis written only when a migration actually does work (#markMigrationPassed).No behavioral change - each migration performs the same transformation under the same conditions; only redundant I/O was removed.
Result
Steady-state boot: ~44 storage requests -> 1 (~97% fewer).
Tests
Added
migration sweep performancetests asserting a fully-migrated install does 1 read / 0 writes, and that the newly-guarded migrations don't re-run.