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

Relax trait bounds for all color types #238

Merged
merged 1 commit into from
Jul 15, 2021
Merged

Relax trait bounds for all color types #238

merged 1 commit into from
Jul 15, 2021

Conversation

Ogeon
Copy link
Owner

@Ogeon Ogeon commented Jul 15, 2021

I removed all trait bound on color type definitions and made them more relaxed in some places. This should also enable const fn in some places! I guess the unfortunate (or fortunate?) effect of this is that it highlighted some shortcomings in the current set if traits. Particularly that the Component + FloatComponent combo doesn't exactly reflect how the type parameters are used and comes with a lot of assumptions. In other words, there's more trait fixing to do than I thought.

Breaking Change

Some forced trait bounds were changed in ways that will be breaking. Particularly on WhitePoint.

@github-actions
Copy link

Benchmark for 24d8385

Click to view benchmark
Test PR Benchmark Master Benchmark %
Cie family/lab to lch 3.3±0.21µs 3.1±0.15µs +6.45%
Cie family/lab to xyz 936.8±46.92ns 967.5±59.19ns -3.17%
Cie family/lch to lab 2.8±0.21µs 2.8±0.08µs 0.00%
Cie family/linsrgb to xyz 3.9±0.22µs 4.1±0.18µs -4.88%
Cie family/xyz to lab 10.8±0.75µs 10.8±0.70µs 0.00%
Cie family/xyz to yxy 760.5±70.61ns 781.5±57.23ns -2.69%
Cie family/yxy to xyz 700.5±55.99ns 712.4±36.64ns -1.67%
Matrix functions/matrix_inverse 13.8±0.82ns 13.5±0.56ns +2.22%
Matrix functions/multiply_3x3 12.2±1.21ns 11.8±0.53ns +3.39%
Matrix functions/multiply_rgb_to_xyz 4.9±0.20ns 5.1±0.37ns -3.92%
Matrix functions/multiply_xyz 5.2±1.57ns 4.9±0.23ns +6.12%
Matrix functions/multiply_xyz_to_rgb 4.7±0.40ns 5.1±0.57ns -7.84%
Matrix functions/rgb_to_xyz_matrix 25.5±1.72ns 24.5±1.52ns +4.08%
Rgb family/hsl to hsv 853.4±69.70ns 825.1±92.25ns +3.43%
Rgb family/hsl to linear hsl 9.7±0.62µs 10.3±0.81µs -5.83%
Rgb family/hsl to rgb 2.3±0.14µs 2.4±0.13µs -4.17%
Rgb family/hsv to hsl 1226.5±88.15ns 1260.0±77.87ns -2.66%
Rgb family/hsv to hwb 280.9±17.06ns 296.1±17.67ns -5.13%
Rgb family/hsv to linear hsv 9.7±0.50µs 9.6±0.49µs +1.04%
Rgb family/hsv to rgb 2.4±0.12µs 2.4±0.10µs 0.00%
Rgb family/hwb to hsv 690.0±61.58ns 697.2±29.64ns -1.03%
Rgb family/hwb to linear hwb 11.5±2.15µs 11.2±1.40µs +2.68%
Rgb family/linear hsl to hsl 10.4±0.54µs 10.4±0.55µs 0.00%
Rgb family/linear hsv to hsv 10.1±0.92µs 10.0±0.58µs +1.00%
Rgb family/linear hwb to hwb 11.6±0.66µs 11.7±1.23µs -0.85%
Rgb family/linsrgb to rgb 5.2±0.37µs 5.2±0.31µs 0.00%
Rgb family/linsrgb_f32 to rgb_u8 6.8±0.65µs 7.1±0.64µs -4.23%
Rgb family/rgb to hsl 979.3±52.35ns 996.7±68.68ns -1.75%
Rgb family/rgb to hsv 718.2±38.49ns 728.8±47.63ns -1.45%
Rgb family/rgb to linsrgb 5.6±0.34µs 5.7±0.31µs -1.75%
Rgb family/rgb_u8 to linsrgb_f32 6.0±0.48µs 6.0±0.31µs 0.00%
Rgb family/xyz to linsrgb 7.6±0.38µs 7.7±0.45µs -1.30%

@Ogeon Ogeon force-pushed the remove_trait_bounds branch from 6f7828e to 2337cf3 Compare July 15, 2021 13:12
@github-actions
Copy link

Benchmark for caeb364

Click to view benchmark
Test PR Benchmark Master Benchmark %
Cie family/lab to lch 3.2±0.14µs 3.1±0.11µs +3.23%
Cie family/lab to xyz 896.5±37.29ns 871.3±46.90ns +2.89%
Cie family/lch to lab 2.2±0.09µs 2.2±0.10µs 0.00%
Cie family/linsrgb to xyz 3.6±0.13µs 3.4±0.14µs +5.88%
Cie family/xyz to lab 10.3±0.34µs 10.2±0.49µs +0.98%
Cie family/xyz to yxy 684.4±34.46ns 640.8±32.17ns +6.80%
Cie family/yxy to xyz 673.5±19.52ns 546.3±21.94ns +23.28%
Matrix functions/matrix_inverse 12.4±0.77ns 12.2±0.66ns +1.64%
Matrix functions/multiply_3x3 9.6±0.35ns 9.4±0.42ns +2.13%
Matrix functions/multiply_rgb_to_xyz 4.6±0.18ns 4.1±0.22ns +12.20%
Matrix functions/multiply_xyz 4.4±0.23ns 4.2±0.20ns +4.76%
Matrix functions/multiply_xyz_to_rgb 4.6±0.22ns 4.7±0.12ns -2.13%
Matrix functions/rgb_to_xyz_matrix 22.8±1.15ns 23.0±1.62ns -0.87%
Rgb family/hsl to hsv 707.3±33.12ns 705.2±0.48ns +0.30%
Rgb family/hsl to linear hsl 8.8±0.38µs 9.3±0.47µs -5.38%
Rgb family/hsl to rgb 2.2±0.09µs 2.2±0.13µs 0.00%
Rgb family/hsv to hsl 975.1±63.47ns 1016.2±63.61ns -4.04%
Rgb family/hsv to hwb 244.2±13.24ns 234.7±14.03ns +4.05%
Rgb family/hsv to linear hsv 8.1±0.33µs 8.3±0.52µs -2.41%
Rgb family/hsv to rgb 2.3±0.12µs 2.2±0.13µs +4.55%
Rgb family/hwb to hsv 507.2±17.51ns 621.3±26.15ns -18.36%
Rgb family/hwb to linear hwb 10.2±0.53µs 9.9±0.67µs +3.03%
Rgb family/linear hsl to hsl 9.3±0.46µs 9.0±0.45µs +3.33%
Rgb family/linear hsv to hsv 8.7±0.35µs 8.9±0.62µs -2.25%
Rgb family/linear hwb to hwb 10.8±0.51µs 11.0±0.52µs -1.82%
Rgb family/linsrgb to rgb 4.3±0.26µs 4.4±0.27µs -2.27%
Rgb family/linsrgb_f32 to rgb_u8 5.7±0.24µs 6.3±0.24µs -9.52%
Rgb family/rgb to hsl 789.0±32.37ns 764.0±40.79ns +3.27%
Rgb family/rgb to hsv 588.7±23.99ns 653.6±41.59ns -9.93%
Rgb family/rgb to linsrgb 4.6±0.25µs 4.5±0.31µs +2.22%
Rgb family/rgb_u8 to linsrgb_f32 4.8±0.18µs 5.1±0.26µs -5.88%
Rgb family/xyz to linsrgb 7.5±0.43µs 7.3±0.40µs +2.74%

@Ogeon Ogeon force-pushed the remove_trait_bounds branch from 2337cf3 to 0b212b0 Compare July 15, 2021 16:47
@Ogeon
Copy link
Owner Author

Ogeon commented Jul 15, 2021

I just realized I forgot PreAlpha, as usual. Will merge after this!

@github-actions
Copy link

Benchmark for 79e4226

Click to view benchmark
Test PR Benchmark Master Benchmark %
Cie family/lab to lch 3.0±0.00µs 3.0±0.00µs 0.00%
Cie family/lab to xyz 814.4±1.43ns 816.7±0.35ns -0.28%
Cie family/lch to lab 2.0±0.00µs 2.1±0.00µs -4.76%
Cie family/linsrgb to xyz 3.2±0.29µs 3.3±0.01µs -3.03%
Cie family/xyz to lab 9.1±0.01µs 9.1±0.01µs 0.00%
Cie family/xyz to yxy 617.3±0.23ns 617.4±0.36ns -0.02%
Cie family/yxy to xyz 571.6±0.22ns 526.5±0.22ns +8.57%
Matrix functions/matrix_inverse 11.4±0.00ns 11.7±0.01ns -2.56%
Matrix functions/multiply_3x3 9.5±0.01ns 14.1±0.01ns -32.62%
Matrix functions/multiply_rgb_to_xyz 4.1±0.00ns 4.1±0.00ns 0.00%
Matrix functions/multiply_xyz 4.1±0.00ns 4.1±0.00ns 0.00%
Matrix functions/multiply_xyz_to_rgb 4.1±0.00ns 4.1±0.00ns 0.00%
Matrix functions/rgb_to_xyz_matrix 21.5±0.01ns 21.4±0.05ns +0.47%
Rgb family/hsl to hsv 621.3±0.26ns 592.2±0.32ns +4.91%
Rgb family/hsl to linear hsl 8.2±0.01µs 8.1±0.01µs +1.23%
Rgb family/hsl to rgb 2.1±0.01µs 2.1±0.01µs 0.00%
Rgb family/hsv to hsl 975.5±2.70ns 881.9±4.52ns +10.61%
Rgb family/hsv to hwb 229.4±0.11ns 231.4±0.10ns -0.86%
Rgb family/hsv to linear hsv 7.7±0.01µs 7.6±0.01µs +1.32%
Rgb family/hsv to rgb 2.1±0.01µs 2.1±0.00µs 0.00%
Rgb family/hwb to hsv 477.0±0.24ns 524.6±0.41ns -9.07%
Rgb family/hwb to linear hwb 9.3±0.01µs 9.3±0.01µs 0.00%
Rgb family/linear hsl to hsl 8.6±0.01µs 8.7±0.03µs -1.15%
Rgb family/linear hsv to hsv 8.2±0.01µs 8.3±0.01µs -1.20%
Rgb family/linear hwb to hwb 10.0±0.01µs 10.0±0.00µs 0.00%
Rgb family/linsrgb to rgb 4.0±0.00µs 4.0±0.00µs 0.00%
Rgb family/linsrgb_f32 to rgb_u8 5.3±0.01µs 5.4±0.01µs -1.85%
Rgb family/rgb to hsl 745.3±0.35ns 741.0±0.35ns +0.58%
Rgb family/rgb to hsv 571.2±0.38ns 565.4±1.73ns +1.03%
Rgb family/rgb to linsrgb 4.3±0.01µs 4.3±0.05µs 0.00%
Rgb family/rgb_u8 to linsrgb_f32 4.6±0.00µs 4.6±0.00µs 0.00%
Rgb family/xyz to linsrgb 7.0±0.00µs 7.0±0.00µs 0.00%

@Ogeon
Copy link
Owner Author

Ogeon commented Jul 15, 2021

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 15, 2021

Build succeeded:

@bors bors bot merged commit 16cb798 into master Jul 15, 2021
@bors bors bot deleted the remove_trait_bounds branch July 15, 2021 17:16
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