Skip to content

Add slots to colors#4136

Merged
freakboy3742 merged 2 commits into
beeware:mainfrom
HalfWhitt:color-slots
Jan 27, 2026
Merged

Add slots to colors#4136
freakboy3742 merged 2 commits into
beeware:mainfrom
HalfWhitt:color-slots

Conversation

@HalfWhitt
Copy link
Copy Markdown
Member

This adds __slots__ to the Color classes, which reduces their size (and should speed up attribute access too). This change cuts the size of the NAMED_COLOR dictionary to about two-thirds of its current size (~38KB to ~26KB).

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@HalfWhitt
Copy link
Copy Markdown
Member Author

Getting hit by #3685 twice in a row...

Copy link
Copy Markdown
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

👍

@freakboy3742 freakboy3742 merged commit cfda3be into beeware:main Jan 27, 2026
167 of 169 checks passed
@HalfWhitt HalfWhitt deleted the color-slots branch January 27, 2026 08:54
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