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

Faster color conversions (Part 2) #652

Merged
merged 1 commit into from
Feb 20, 2022

Conversation

rfuest
Copy link
Member

@rfuest rfuest commented Feb 20, 2022

This PR is a small addition to #651. Color conversions between color types that share some channel bit depths, like Rgb565 and Rgb555, will now only calculate the conversion for the channels with different bit depths. The effect of this change was minimal to non existing on my desktop, but I think it can't hurt to add it. The compiler seems to already optimize away some redundant calculations now that convert_channel uses const generics instead of parameters.

I've also added benches for the color conversions. Here is a comparison from before #651 and after this PR:
grafik
Note that Rgb888 to Gray8 doesn't use any of the code that was modified in the recent PRs and is only included for completeness.

Copy link
Member

@jamwaffles jamwaffles 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. I ran the benches on my rPi 4 with similar results 👍

@rfuest rfuest merged commit 037abd1 into embedded-graphics:master Feb 20, 2022
@rfuest rfuest deleted the color-conversions-2 branch February 20, 2022 17:18
@rfuest
Copy link
Member Author

rfuest commented Feb 20, 2022

Looks good. I ran the benches on my rPi 4 with similar results +1

Great, thanks for verifying the result. I hadn't expected such a big improvement.

@rfuest rfuest mentioned this pull request Feb 20, 2022
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.

None yet

2 participants