-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
PR: Improve CFI 2017 and TM30-18 Performance #1120
Conversation
Looks like I did actually mess up the tests some how... I was really hoping that was my local environment quarks. |
6d4e98a
to
283e544
Compare
@KelSolaar looks like the only issue left is the PCA issue. We'll have to figure out a plan for those PCA tests. FYI three of them are failing on my local machine. I suspect that small changes in the code base are affecting floating point errors and that's feeding forward into PCA results. |
ee2899b
to
8045c1c
Compare
Status: around 42x faster than v.0.4.2 release |
@KelSolaar we have about an 100x performance improvement for TM30 in this branch now. I think it should be merged. I'd like to get another 2x faster than this... but that will require more significant refactoring. First targets if anyone wants to pick it up are the Ohno 2013 code and the CAM code... I might introduce / write a paper on a highly compute optimized CAM. That could be nice in the future. Anyway... The only failing tests look like some of those precision errors. The tests pass on my local machine. Let me know if you want me to fix the tests, or what you'd like to do to pass this. And of course... looking forward to your review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @tjdcs!
A lot of good and exciting stuff there. I did a first review pass. I would be keen to clean up the commits a bit as discussed on Slack.
colour/appearance/ciecam02.py
Outdated
@@ -231,6 +230,7 @@ def XYZ_to_CIECAM02( | |||
"Average" | |||
], | |||
discount_illuminant: bool = False, | |||
compute_HQ: bool = True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Major
Wondering if we should not generalise which correlates to compute. Having modified the CIECAM02
signature begs for modifying other CAMs for consistency. We could also have an inlined version of the model that is optimised for speed. We have a Hellwig et al. (2022) implementation that is inlined here for example: https://github.com/colour-science/colour/blob/feature/flattened_hellwig2022/colour/appearance/hellwig2022.py#L154
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My personal preference actually is that all color models are flattened, or close to it. Even models that are substantially similar.
As for generalizing a "which components to compute" that sounds like a great feature... but I don't want to address that in this PR. I like the proposal though.
colour/temperature/ohno2013.py
Outdated
------- | ||
:class:`numpy.ndarray` | ||
*CIE UCS* colourspace *uv* chromaticity coordinates. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor
Ditto for example.
@KelSolaar This is greatly cleaned up now if you want to give it another pass. |
c832828
to
ad67a6b
Compare
ad67a6b adds a dependency on xxhash which is an extremely fast hashing algorithm specifically suited for dictionary keys. https://github.com/Cyan4973/xxHash#quality |
44dc34a
to
f83b0f1
Compare
@tjdcs : Where are we with this one? |
Bizarre corner cases in the initialization of It's going to be a small while before I can address these on my own. :/ i have to prep for cinegear, and then infocomm. I have urgent work projects taking the few days I have in between. Probably the end of June is when I will have serious time to sit down with this again. |
Thanks, sounds good! I'm going to update Pyright on our side so that we run the latest and then we can rebase your branch on top of |
|
9dc7021
to
36d9255
Compare
I looked quickly why the docs build is failing and I think that we are destroying the blackbody spectral distributions that we defined here : colour/utilities/generate_plots.py Line 187 in 36d9255
This is one of the reason why I would be keen to drop the Poetry commit from this PR as it is a separate problem and just created a huge mess on my end, took me a while to realise what had happened. |
Repair documenation build error fix test due to default interpolation change [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci fix peculier init case in MaxOS environment fix type checking Auto stash before revert of "Improve default interpolation performance"
b9ad315
to
0558836
Compare
@KelSolaar ready for a final review, assuming that you are OK if I hurt coverage by 3 lines... |
- Remove unnecessary interpolator change. - Improve documentation around spectral generator interpolation changes.
Just pushed a small varnishing pass, hopefully we can merge right after if everything builds. |
LGTM, happy to merge? |
Make it so! |
Merged, thanks for the great work @tjdcs! Do you remember roughly the performance improvements for the release notes? |
45x from pre-merge commit. From when the work started I think it was around 100x I can check that tomorrow. Some other performance stuff got merged in early or there were other changes. I backed out some of the hashing improvements which is the next big thing, but in order to do it with good code style we need to make xxhash a default install. (need to access private |
|
Summary
This PR implements several performance improvements, again, that should improve the speed and quality of the entire code base. These improvements mainly revolve around caching in certain places during sd_to_XYZ in order to prevent excessive copies of CMFs etc...
Because these features change caching behavior there is a small risk that there will be regressions, despite the tests passing so it is requested that it is tried in some other developer applications before merging.
2X performance improvement in CFI 2017 workloads
Preflight
Code Style and Quality
New transformations have been added to the Automatic Colour Conversion Graph.New transformations have been exported to the relevant namespaces, e.g.colour
,colour.models
.Documentation
New features are documented along with examples if relevant.The documentation is Sphinx and numpydoc compliant.