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

[Core] Add CenterID singleton #9337

Merged
merged 1 commit into from
Sep 18, 2024
Merged

[Core] Add CenterID singleton #9337

merged 1 commit into from
Sep 18, 2024

Conversation

driusan
Copy link
Collaborator

@driusan driusan commented Sep 12, 2024

This adds a singleton method to the CenterID to cache the instantiation and re-use it. The value of a CenterID often comes from the database as an int, but needs to be converted to a CenterID class in order for various function calls and type checking (in particular, for permission access.) Instantiating a new CenterID each time uses a large amount of memory and puts a large degree of pressure on the garbage checker for big datasets, especially places that need to check access to many candidates or timepoints (such as the dataquery module.)

Replacing it with a singleton uses much less memory in these cases.

Copy link
Contributor

@GeorgeMurad GeorgeMurad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@driusan driusan merged commit cb419c6 into aces:main Sep 18, 2024
28 checks passed
maximemulder pushed a commit to maximemulder/Loris that referenced this pull request Sep 25, 2024
This adds a singleton method to the CenterID to cache the instantiation and re-use it. The value of a CenterID often comes from the database as an int, but needs to be converted to a CenterID class in order for various function calls and type checking (in particular, for permission access.) Instantiating a new CenterID each time uses a large amount of memory and puts a large degree of pressure on the garbage checker for big datasets, especially places that need to check access to many candidates or timepoints (such as the dataquery module.)

Replacing it with a singleton uses much less memory in these cases.
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