Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Lazy Loading Feature #4308

Closed
wants to merge 3 commits into from

Conversation

FirePheonix
Copy link
Contributor

Issue:

Earlier, MB was loading every single project file from IndexedDB into memory.
406660105-62b4f823-5f05-48e8-936e-333a9b5dbb15

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:
ProjectStorage js - musicblocks - Visual Studio Code 26-01-2025 10_22_38

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.

@omsuneri
Copy link
Contributor

omsuneri commented Jan 26, 2025

@FirePheonix i appreciate your contribution but i think we need to think more on this issue to get the best solution instead of just lazy loading we can do some more options as well like Batch Processing, Compression of JSON Data, Optimize Project Metadata, Browser Storage Alternatives, Implement Local Storage Management( I dont actually prefer this but saw someone mention this too) so @pikurasa i think we need to discuss about this and then try to move ahead

@FirePheonix
Copy link
Contributor Author

FirePheonix commented Jan 26, 2025

@omsuneri While I was trying to solve the issue, I did look upon the following mentioned methods as well. I think lazy loading might be the best method in this case since we're trying to optimize the INITIAL loading time and we only want to access a small portion of data.
But MAYBE Lazy Loading and compression of JSON data can go hand in hand?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants