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

Split Clamp into smaller traits and implement for [T] #247

Merged
merged 1 commit into from
Jul 19, 2021
Merged

Conversation

Ogeon
Copy link
Owner

@Ogeon Ogeon commented Jul 18, 2021

This adds back a replacement for clamp_self, but I'm going for the *_assign naming convention, and also splits Clamp into separate IsWithinBounds, Clamp and ClampAssign. This allows separate implementations for some traits that wouldn't be compatible with the other traits. For example [T] can't implement Clamp in a nice way since it requires moving self.

Breaking Change

This moves the is_within_bounds method into IsWithinBounds.

@Ogeon Ogeon changed the title Split Clamp into smaller traits and implement for [T] Split Clamp into smaller traits and implement for [T] Jul 18, 2021
@github-actions
Copy link

Benchmark for 504a494

Click to view benchmark
Test PR Benchmark Master Benchmark %
Cie family/lab to lch 2.7±0.15µs 2.6±0.08µs +3.85%
Cie family/lab to xyz 729.2±25.42ns 739.2±39.98ns -1.35%
Cie family/lch to lab 1879.2±44.80ns 1919.1±95.34ns -2.08%
Cie family/linsrgb to xyz 2.9±0.08µs 2.9±0.14µs 0.00%
Cie family/xyz to lab 8.2±0.31µs 8.3±0.50µs -1.20%
Cie family/xyz to yxy 547.7±23.25ns 558.4±24.15ns -1.92%
Cie family/yxy to xyz 473.0±19.05ns 486.0±28.49ns -2.67%
Matrix functions/matrix_inverse 10.1±0.39ns 10.1±0.31ns 0.00%
Matrix functions/multiply_3x3 8.1±0.37ns 8.1±0.34ns 0.00%
Matrix functions/multiply_rgb_to_xyz 3.6±0.11ns 3.6±0.13ns 0.00%
Matrix functions/multiply_xyz 3.7±0.18ns 3.7±0.17ns 0.00%
Matrix functions/multiply_xyz_to_rgb 3.6±0.16ns 3.9±0.26ns -7.69%
Matrix functions/rgb_to_xyz_matrix 20.2±1.35ns 19.2±0.94ns +5.21%
Rgb family/hsl to hsv 593.9±36.39ns 514.3±20.10ns +15.48%
Rgb family/hsl to linear hsl 7.4±0.37µs 7.7±0.42µs -3.90%
Rgb family/hsl to rgb 1891.9±73.81ns 1954.0±103.54ns -3.18%
Rgb family/hsv to hsl 940.7±34.58ns 851.0±35.20ns +10.54%
Rgb family/hsv to hwb 204.3±8.20ns 207.2±7.96ns -1.40%
Rgb family/hsv to linear hsv 7.7±0.35µs 6.9±0.41µs +11.59%
Rgb family/hsv to rgb 1874.8±101.64ns 2.2±0.10µs -14.78%
Rgb family/hwb to hsv 418.1±12.99ns 439.6±45.64ns -4.89%
Rgb family/hwb to linear hwb 8.6±0.37µs 8.4±0.38µs +2.38%
Rgb family/linear hsl to hsl 7.7±0.34µs 7.9±0.36µs -2.53%
Rgb family/linear hsv to hsv 7.3±0.26µs 7.3±0.32µs 0.00%
Rgb family/linear hwb to hwb 9.0±0.35µs 9.4±0.82µs -4.26%
Rgb family/linsrgb to rgb 3.6±0.14µs 3.6±0.17µs 0.00%
Rgb family/linsrgb_f32 to rgb_u8 4.8±0.21µs 4.8±0.19µs 0.00%
Rgb family/rgb to hsl 659.4±21.60ns 669.9±23.17ns -1.57%
Rgb family/rgb to hsv 505.9±17.68ns 512.6±20.18ns -1.31%
Rgb family/rgb to linsrgb 3.9±0.28µs 3.9±0.26µs 0.00%
Rgb family/rgb_u8 to linsrgb_f32 4.1±0.16µs 4.2±0.27µs -2.38%
Rgb family/xyz to linsrgb 6.7±0.27µs 6.8±0.22µs -1.47%

@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 9420855 into master Jul 19, 2021
@bors bors bot deleted the improve_clamp branch July 19, 2021 10:29
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.

1 participant