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

fix: Optimize memory usage when parsing LgFiles #9614

Merged
merged 5 commits into from
Aug 1, 2023

Conversation

sw-joelmut
Copy link
Collaborator

#minor

Description

This PR reduces the memory usage when parsing the LgFiles (lgParse.worker) by adding a MapOptimizer to the LgFilesCache.
This optimizer consists of, based on a capacity limit, the process will start removing LgFile parse results to free up space from memory. Additionally, it takes into account all the references and relationships between other LgFiles.

Note: The MapOptimizer capacity limit is set to store a maximum of 10 parsed LgFiles, this amount can be modified through code.

Screenshots

The following image shows loading 9 bot responses with the MapOptimizer capacity size of 3 (for testing purposes), seeing the improvement in memory usage.
image

@sw-joelmut sw-joelmut changed the title Optimize memory usage when parsing LgFiles fix: Optimize memory usage when parsing LgFiles Jul 21, 2023
@coveralls
Copy link

coveralls commented Jul 21, 2023

Coverage Status

coverage: 54.49% (-0.08%) from 54.567% when pulling 5c73b9d on southworks/add/map-optimizer into 8856d24 on main.

@OEvgeny
Copy link
Collaborator

OEvgeny commented Jul 24, 2023

Looks good, left a couple of comments to address.

Nice work!

@sw-joelmut
Copy link
Collaborator Author

Hi @OEvgeny, the suggestions are applied, thanks!

@OEvgeny OEvgeny merged commit 145acb8 into main Aug 1, 2023
5 checks passed
@OEvgeny OEvgeny deleted the southworks/add/map-optimizer branch August 1, 2023 16:12
@cwhitten cwhitten mentioned this pull request Aug 15, 2023
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.

3 participants