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

Optimize classes by adding __slots__ #102

Open
wants to merge 2 commits into
base: dev-2.x
Choose a base branch
from
Open

Conversation

GLEF1X
Copy link
Owner

@GLEF1X GLEF1X commented Nov 30, 2022

Benchmarks show that adding __slots__ to the classes reduce memory usage by 4-6%.

Without __slots__:

old

With it:

new


async def _fetch_history(self) -> History:
end_date = localize_datetime_according_to_moscow_timezone(datetime.now())
async def _fetch_history(self) -> Optional[History]:

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
@lgtm-com
Copy link

lgtm-com bot commented Nov 30, 2022

This pull request fixes 17 alerts when merging e6d24eb into fcb9a93 - view on LGTM.com

fixed alerts:

  • 16 for Unused import
  • 1 for Module is imported with 'import' and 'import from'

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed 🚀. For more information, please check out our post on the GitHub blog.

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.

1 participant