-
Notifications
You must be signed in to change notification settings - Fork 61
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 Rgb to Hsl and Hsv conversions #54
Conversation
I've added the before and after benchmark and tests code to the benches folder. Let me know if they should be removed. Rgb to Hsl benchmarks
Rgb to Hsv benchmarks
|
Cool! And nice speedup. Are these new algorithms hand crafted or is there a source for them? (just curious) The benchmarks can stay, but how come they aren't using the |
It started with me noticing that there are unnecessary comparisons for finding both max and min and trying to optimize them.I also a stackoverflow answer that basically said the same, you can find max and min in 3 comparisons instead of 4.
I didn't check with the into_hsl and hsv. I guess because running the benchmarks will then no longer make sense once this is merged. |
Yea, it was pretty naive before, since the first goal was to just get the basics down.
What I meant was to run the Thank you for including them, anyway. It's nice to see some numbers. |
Just checked. The trait version is equally fast.
|
Alright, seems like inlining works as expected in this case. |
Removed the benches. Should be good to go. |
The |
This looks great! Can't find anything to fix here 👍 Thank you! @homu r+ |
📌 Commit cdb4a3f has been approved by |
⚡ Test exempted - status |
Faster Rgb to Hsl and Hsv conversions Faster conversion from Rgb to Hsl and Rgb to Hsv
Faster conversion from Rgb to Hsl and Rgb to Hsv