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 in all classes #1079

Closed
wants to merge 1 commit into from
Closed

Conversation

adbar
Copy link
Contributor

@adbar adbar commented Jan 13, 2025

Type of pull request:

  • Bug fix
  • Feature
  • Other

Description:

Since we're at it I thought we could add slots in all classes (the TypedDict classes are not concerned).

Related Issues:

See discussion in PR #1075.

Checklist:

  • I have read and followed the contribution guidelines.
  • I have added necessary documentation (if applicable).
  • The changes pass all existing tests.

@MarkZH
Copy link
Collaborator

MarkZH commented Jan 15, 2025

I'm reluctant to merge this. The documentation indicates that slots are purely for performance optimization and lichess-bot isn't a bottleneck. All lichess-bot does is act as a translator for messages between lichess.org and chess bots. This change may save microseconds, but lichess-bot is always waiting at least tens or hundreds of milliseconds for network traffic and bot calculations. In fact, most of the computation lichess-bot does is handled by the python-chess library, which doesn't use slots anywhere.

@AttackingOrDefending, any comments?

@AttackingOrDefending
Copy link
Member

I would also prefer not adding __slots__, as they make the code less readable in my opinion. #1069 was merged as it made some readability changes (e.g. changing elif to if) and improved the speed without loss in the readability of that code.

@adbar
Copy link
Contributor Author

adbar commented Jan 15, 2025

OK, I understand.

@adbar adbar closed this Jan 15, 2025
@adbar adbar deleted the use_slots branch January 15, 2025 21:07
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.

3 participants