-
Notifications
You must be signed in to change notification settings - Fork 19
GCI1442 [Team TREE][2025] - Reduce memory footprint of dataclasses #82
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
base: main
Are you sure you want to change the base?
GCI1442 [Team TREE][2025] - Reduce memory footprint of dataclasses #82
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR seems good (just remove overring of creedengo-rules-specifications)
pom.xml
Outdated
@@ -69,7 +69,7 @@ | |||
<mockito.version>5.17.0</mockito.version> | |||
|
|||
<!-- temporary version waiting for a real automatic release in creedengo repository --> | |||
<creedengo-rules-specifications.version>2.2.2</creedengo-rules-specifications.version> | |||
<creedengo-rules-specifications.version>main-SNAPSHOT</creedengo-rules-specifications.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be commited
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes thank you. Done
This PR has been automatically marked as stale because it has no activity for 30 days. |
Added rule GCI1442.
Since python 3.10 dataclass instances can easily enable a memory optimization
By default, when we define a class in Python, it uses a dict to store its attributes and methods.
This means that every instance of the class has an extensible dictionary to store its data, this flexibility comes at the cost of memory usage.
When we use slots, Python creates a tuple to store the attributes of the class instead of a dictionary, reducing memory usage.
Reference :
green-code-initiative/creedengo-challenge#32
green-code-initiative/creedengo-rules-specifications#409