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

Implement singleton pattern for Immutable objects #550

Open
MicahGale opened this issue Sep 18, 2024 · 0 comments
Open

Implement singleton pattern for Immutable objects #550

MicahGale opened this issue Sep 18, 2024 · 0 comments
Assignees
Labels
feature request An issue that improves the user interface. performance 🐌 Issues related to speed and memory
Milestone

Comments

@MicahGale
Copy link
Collaborator

There are a few immutable objects that are frequently used, namely: Element. There's no reason that these instances couldn't be shared so a "singleton-like" pattern might help save memory.

I confirmed this was note the case:

In [1]: import montepy

In [2]: el1= montepy.data_inputs.element.Element(92)

In [3]: el2= montepy.data_inputs.element.Element(92)

In [4]: hex(id(el1))
Out[4]: '0x7fa5c7d14410'

In [5]: hex(id(el2))
Out[5]: '0x7fa5f8b4f770'
@MicahGale MicahGale added feature request An issue that improves the user interface. performance 🐌 Issues related to speed and memory labels Sep 18, 2024
@MicahGale MicahGale mentioned this issue Sep 23, 2024
32 tasks
@MicahGale MicahGale added this to the 1.0.0-alpha milestone Nov 8, 2024
@MicahGale MicahGale self-assigned this Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request An issue that improves the user interface. performance 🐌 Issues related to speed and memory
Projects
None yet
Development

No branches or pull requests

1 participant