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.
Issue:
Earlier, MB was loading every single project file from IndexedDB into memory.
Improvises on: #4305
What does this PR do?
This PR documents the lazy loading mechanism implemented in the ProjectStorage,js class. Lazy loading ensures efficient memory usage by deferring the loading of project-specific data until it is explicitly required by the user itself.
How Lazy Loading Works
Initialization:
During the init method, only metadata (e.g., project IDs, current project ID) is restored. Full project data is not loaded.
Dynamic Data Fetching:
Methods like getCurrentProjectData and getCurrentProjectImage fetch project data dynamically from storage when accessed.
Example from getCurrentProjectData:
Caching for Reuse:
Once fetched, project data is cached in this.data.Projects for subsequent accesses, avoiding repeated storage queries.
How it helps
Optimized Memory: Only required data is loaded into memory.
Improved Performance: Reduces initialization time for large projects.
Scalability: Handles many projects efficiently.
Testing:
We'll have to test it in a computer with Lower GPU ALONG with where A LARGE NUMBER of projects (~500) are there.