Skip to content

Implement singleton pattern for Immutable objects #550

@MicahGale

Description

@MicahGale

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'

Metadata

Metadata

Assignees

Labels

feature requestAn issue that improves the user interface.performance 🐌Issues related to speed and memory

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions