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

Improve type stability in conversion methods #427

Merged
merged 1 commit into from
May 4, 2021

Conversation

kimikage
Copy link
Collaborator

@kimikage kimikage commented May 27, 2020

I found some type instability issues while tackling JuliaLang/julia#35972 or #425. Unfortunately, this doesn't solve JuliaLang/julia#35972, and doesn't provide much performance improvement.

This is a successor of PR #424. (Merged. However, I'm still looking for a way to solve #425.)
This should be the next v0.13 material since this changes the conversion results slightly.

Comment on lines 324 to 330
fy = (c.l + 16) / 116
fx = c.a / 500 + fy
fx = fy + c.a / 500
fz = fy - c.b / 200
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change these divisions into reciprocal multiplications, this method can be inlined, i.e. successfully vectorized. However, even if only Lab-->XYZ conversion is speeded up, Lab-->RGB conversion is not speeded up.

@codecov
Copy link

codecov bot commented May 27, 2020

Codecov Report

Merging #427 (da8c60b) into master (65c4e5a) will decrease coverage by 0.12%.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #427      +/-   ##
==========================================
- Coverage   91.21%   91.08%   -0.13%     
==========================================
  Files           9        9              
  Lines         956      965       +9     
==========================================
+ Hits          872      879       +7     
- Misses         84       86       +2     
Impacted Files Coverage Δ
src/conversions.jl 99.32% <92.85%> (-0.68%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65c4e5a...da8c60b. Read the comment docs.

@kimikage kimikage changed the title Improve type stability in conversion methods and find_maximum_chroma Improve type stability in conversion methods Aug 25, 2020
@kimikage
Copy link
Collaborator Author

I separated part of this PR to #442.

@kimikage kimikage force-pushed the stability branch 2 times, most recently from 518d4ea to 5f23315 Compare March 2, 2021 07:35
This also optimizes conversion methods and changes the results slightly.
@kimikage kimikage marked this pull request as ready for review April 29, 2021 10:25
@kimikage
Copy link
Collaborator Author

kimikage commented Apr 29, 2021

Now that we have added the support for ColorTypes v0.11, we will start developing Colors v0.13 series. This means that breaking changes can be merged.

Also, Colors v0.13.0 is scheduled to be released at the same time as ColorTypes v0.12.0, so there will be some time before the release. In other words, even if bugs are introduced, that is not a problem as long as they are fixed before the release.

@kimikage kimikage merged commit 98d34eb into JuliaGraphics:master May 4, 2021
@kimikage kimikage deleted the stability branch May 4, 2021 06:12
kimikage added a commit to kimikage/Colors.jl that referenced this pull request May 11, 2024
This also optimizes conversion methods and changes the results slightly.
kimikage added a commit that referenced this pull request May 11, 2024
This also optimizes conversion methods and changes the results slightly.
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