Skip to content

Conversation

@ids1024
Copy link
Member

@ids1024 ids1024 commented Apr 11, 2023

Division is more expensive than multiplication, and this doesn't seem to be optimize away, so iterating over (0..height) and (0..width) provides better performance.

It's good to have the example show the best way to write code using softbuffer, and this helps when using examples as a benchmark. This will also be needed if Softbuffer supports formats where stride isn't just width * pixel_size, and needs alignment.

Division is more expensive than multiplication, and this doesn't seem to
be optimize away, so iterating over `(0..height)` and `(0..width)`
provides better performance.

It's good to have the example show the best way to write code using
softbuffer, and this helps when using examples as a benchmark. This will
also be needed if Softbuffer supports formats where `stride` isn't just
`width * pixel_size`, and needs alignment.
@ids1024 ids1024 requested a review from john01dav as a code owner April 11, 2023 19:30
Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

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

LGTM

@jackpot51 jackpot51 merged commit a0b9c59 into master Apr 12, 2023
@jackpot51 jackpot51 deleted the example-optimize branch April 12, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants