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 for str hex color values #3302

Merged
merged 1 commit into from
Jan 25, 2025
Merged

Optimize for str hex color values #3302

merged 1 commit into from
Jan 25, 2025

Conversation

ankith26
Copy link
Member

Inspired by #3297

That PR optimized str colordict access but left hexcolor optimization for the future, this PR tackles that now. After this PR, a similar 2-3x performance enhacement is seen for the hex color case as well.

@ankith26 ankith26 requested a review from a team as a code owner January 23, 2025 06:00
@Starbuck5 Starbuck5 added Performance Related to the speed or resource usage of the project color pygame.color labels Jan 24, 2025
Copy link
Member

@Starbuck5 Starbuck5 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I like the PyUnicode_AsUTF8AndSize simplification as well.

Copy link
Member

@damusss damusss left a comment

Choose a reason for hiding this comment

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

Tested it an the speedups are there as promised :) Thanks for "completing" my work

@damusss damusss added this to the 2.5.3 milestone Jan 25, 2025
@damusss damusss merged commit bd712ff into main Jan 25, 2025
25 checks passed
@damusss damusss deleted the ankith26-color-speedup branch January 25, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
color pygame.color Performance Related to the speed or resource usage of the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants