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

Add a MixAssign trait and remove the Float requirement from Mix #248

Merged
merged 1 commit into from
Jul 19, 2021

Conversation

Ogeon
Copy link
Owner

@Ogeon Ogeon commented Jul 19, 2021

This adds a MixAssign trait that allows interpolating without moving or cloning more than necessary. I have also removed the requirement that the Scalar implements Float.

Breaking Change

Removing the Float requirement also removes the implication T: Mix -> T::Scalar: Float, possibly breaking some generic implementations (hence the changes in gradinet).

@github-actions
Copy link

Benchmark for a63abcb

Click to view benchmark
Test PR Benchmark Master Benchmark %
Cie family/lab to lch 3.5±0.16µs 3.3±0.23µs +6.06%
Cie family/lab to xyz 990.3±55.87ns 951.2±24.88ns +4.11%
Cie family/lch to lab 2.6±0.18µs 2.4±0.10µs +8.33%
Cie family/linsrgb to xyz 3.8±0.08µs 3.7±0.25µs +2.70%
Cie family/xyz to lab 11.1±0.82µs 10.9±0.56µs +1.83%
Cie family/xyz to yxy 727.3±14.42ns 759.5±44.51ns -4.24%
Cie family/yxy to xyz 614.7±11.88ns 640.7±75.01ns -4.06%
Matrix functions/matrix_inverse 13.2±1.03ns 13.2±0.52ns 0.00%
Matrix functions/multiply_3x3 11.5±1.01ns 10.8±0.71ns +6.48%
Matrix functions/multiply_rgb_to_xyz 4.9±0.21ns 4.8±0.28ns +2.08%
Matrix functions/multiply_xyz 4.8±0.25ns 4.9±0.29ns -2.04%
Matrix functions/multiply_xyz_to_rgb 5.0±0.41ns 4.9±0.44ns +2.04%
Matrix functions/rgb_to_xyz_matrix 25.0±1.65ns 25.2±0.56ns -0.79%
Rgb family/hsl to hsv 808.0±48.42ns 808.8±40.79ns -0.10%
Rgb family/hsl to linear hsl 9.8±0.72µs 9.6±0.23µs +2.08%
Rgb family/hsl to rgb 2.4±0.08µs 2.5±0.26µs -4.00%
Rgb family/hsv to hsl 1176.8±99.37ns 1196.8±79.03ns -1.67%
Rgb family/hsv to hwb 250.3±11.12ns 267.8±23.77ns -6.53%
Rgb family/hsv to linear hsv 8.8±0.39µs 8.6±0.57µs +2.33%
Rgb family/hsv to rgb 2.5±0.16µs 2.4±0.16µs +4.17%
Rgb family/hwb to hsv 568.4±29.48ns 548.5±21.71ns +3.63%
Rgb family/hwb to linear hwb 10.8±0.95µs 10.6±0.31µs +1.89%
Rgb family/linear hsl to hsl 10.2±0.87µs 9.8±0.39µs +4.08%
Rgb family/linear hsv to hsv 9.0±0.41µs 9.6±0.32µs -6.25%
Rgb family/linear hwb to hwb 11.6±0.70µs 11.3±0.36µs +2.65%
Rgb family/linsrgb to rgb 4.6±0.20µs 4.8±0.34µs -4.17%
Rgb family/linsrgb_f32 to rgb_u8 6.3±0.18µs 6.6±0.77µs -4.55%
Rgb family/rgb to hsl 876.0±71.41ns 857.0±50.19ns +2.22%
Rgb family/rgb to hsv 745.7±139.04ns 691.9±42.21ns +7.78%
Rgb family/rgb to linsrgb 5.0±0.35µs 5.0±0.44µs 0.00%
Rgb family/rgb_u8 to linsrgb_f32 5.3±0.17µs 5.4±0.33µs -1.85%
Rgb family/xyz to linsrgb 8.5±0.38µs 9.1±0.49µs -6.59%

@Ogeon
Copy link
Owner Author

Ogeon commented Jul 19, 2021

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 19, 2021

Build succeeded:

@bors bors bot merged commit 107cde3 into master Jul 19, 2021
@bors bors bot deleted the mix_assign branch July 19, 2021 14:12
@Ogeon Ogeon changed the title Add a MixAssign trait and remove the Float requirement from Mix Add a MixAssign trait and remove the Float requirement from Mix Mar 19, 2023
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

1 participant