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

Add __slots__ to AsyncLimiter #85

Merged
merged 4 commits into from
Aug 9, 2022
Merged

Add __slots__ to AsyncLimiter #85

merged 4 commits into from
Aug 9, 2022

Conversation

harshil21
Copy link
Contributor

Adding __slots__ reduces memory usage (important here since one can have many AsyncLimiter instances) and speeds up attribute access. See here to learn more

Copy link
Owner

@mjpieters mjpieters left a comment

Choose a reason for hiding this comment

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

I love it. Yes, I'm well aware of the advantages of using __slots__!

I have only two reservations:

  • with this change you no longer can create weak references to limiter instances. I don't think this is a big issue; we can always add __weakref__ to the slots listing if someone comes up with a compelling use-case in future.
  • can you please add a changelog entry for this? Create a 85.feature file in the changelog.d directory describing this change (format is restructuredtext).

@harshil21 harshil21 closed this Aug 8, 2022
@harshil21 harshil21 deleted the patch-1 branch August 8, 2022 19:50
@harshil21 harshil21 restored the patch-1 branch August 8, 2022 19:51
@harshil21 harshil21 reopened this Aug 8, 2022
changelog.d/85.feature Outdated Show resolved Hide resolved
Co-authored-by: Martijn Pieters <github.com@zopatista.com>
@sonarcloud
Copy link

sonarcloud bot commented Aug 9, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@mjpieters mjpieters merged commit 02627f3 into mjpieters:master Aug 9, 2022
@mjpieters
Copy link
Owner

And, merged! Thanks for your contribution!

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