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

use slots for ParkingLot and Event #1943

Closed
belm0 opened this issue Apr 3, 2021 · 1 comment
Closed

use slots for ParkingLot and Event #1943

belm0 opened this issue Apr 3, 2021 · 1 comment

Comments

@belm0
Copy link
Member

belm0 commented Apr 3, 2021

For the wait queue use case, ParkingLot is efficient and doesn't generate garbage.

However if a wait queue is needed on anyio, you'd have to use Event and create a new instance on each set(). Event doesn't use slots, and contains ParkingLot which also doesn't use slots. So that's two unslotted class instances per set().

Any reason not to use slots on these classes?

belm0 added a commit to belm0/trio that referenced this issue Apr 5, 2021
@belm0
Copy link
Member Author

belm0 commented Apr 7, 2021

Event was made more efficient and no longer depends on ParkingLot.

I forgot to have ParkingLot use slots in the PR, but that's relatively minor now-- for another day.

@belm0 belm0 closed this as completed Apr 7, 2021
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 a pull request may close this issue.

1 participant