Skip to content

Conversation

@sparklost
Copy link
Contributor

@sparklost sparklost commented Jul 21, 2024

In draw_circle_xiaolinwu_thin, pow(radius, 2) was inside loop, but radius isn't changing.
So, radius is now moved outside of the loop.
Same thing happened in draw_circle_xiaolinwu.
Performance gain: 5% faster execution with r=100, and 6% with r=1000, for 1px wide line.
Also fixed typo: Xaolin -> Xiaolin

Moved pow(radius, 2) outside of loop
@sparklost sparklost requested a review from a team as a code owner July 21, 2024 23:53
Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! 🥳

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.

LGTM, nice :3

@damusss damusss added this to the 2.5.1 milestone Jul 22, 2024
@damusss damusss merged commit ba6d659 into pygame-community:main Jul 22, 2024
@Starbuck5 Starbuck5 added Performance Related to the speed or resource usage of the project draw pygame.draw labels Jul 22, 2024
@sparklost sparklost deleted the aacircle_optimize branch July 22, 2024 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

draw pygame.draw Performance Related to the speed or resource usage of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants