-
Notifications
You must be signed in to change notification settings - Fork 47
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
Work around #496 for Luv, Lab #511
Conversation
Codecov Report
@@ Coverage Diff @@
## master #511 +/- ##
==========================================
- Coverage 94.97% 94.72% -0.25%
==========================================
Files 9 9
Lines 1193 1213 +20
==========================================
+ Hits 1133 1149 +16
- Misses 60 64 +4
Continue to review full report at Codecov.
|
I am interested in how you found this workaround. Also, I would like to know the specific cases where this workaround is effective. |
Ah, very simple actually. And so anything that ran code related to colorspace conversion from toplevel was a candidate. Just searching for |
Following up: The caching is an independent step that caches all methods + their specializations defined in the package. Anything that gets compiled is a specialization, so But actually, the paragraph above this one makes me think: given all the inference failures in JuliaGraphics/ColorTypes.jl#266, would some of our weird issues be fixed by switching from |
Thank you for the detailed explanation. It is very logical. However, I feel that the effect of this PR is somewhat less than the logical expectation. Of course, since the rewriting of the core code of conversions is mostly complete, there is no major disadvantage to making the |
I'm in no hurry to merge this, if you want to investigate more. Just wanted to make sure you knew about the causes & potential workarounds. |
If we use |
It seems that a simple switching does not work well. 🤔 It might be worth looking into the differences with |
The reason for the difference is known ( |
For example, if we don't call function _get_hue_in(::Type{C}, r, g, b) where C <: Union{Luv, Lab}
xyz = linear_rgb_to_xyz(RGB{Float64}(r, g, b))
wp = WP_DEFAULT
if C === Luv
c = xyz2luv(Luv{Float64}, xyz, xyz.y, xyz_to_uv(wp))
else
c = xyz2lab(Lab{Float64}, XYZ(xyz.x / wp.x, xyz.y, xyz.z / wp.z))
end
hue(c)
end
const LUV_HUE_R = _get_hue_in(Luv, 1, 0, 0)
... Unlike |
I see some room for improvement in the implementation of I will merge #509 after merging this. |
I'm not sure it's much of a mystery anymore, it's just a difficult fix. |
This fixes the specific demo in #496. These constants were added in 8f6550d, but there is nothing wrong with that PR---those should be perfectly reasonable operations to perform during package definition.
The origin of the problem is a julia bug whose identity remains mysterious. Some diagnostics were done in JuliaLang/julia#35972, but this particular case appears to be distinct from the mechanism identified there and has not yet been isolated. This is a simple workaround.