Repository navigation
Avoid copying non-contiguous data in CompImageHDU - #14425
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
If this fixes some long-standing performance issue, should add a change log. Thanks! |
|
I'm not sure that anyone has ever complained about the performance issue as such hence why I don't think it matters. But we should definitely remove this code as it is unnecessary. |
|
I think we usually use "feature" for perf improvements and the idea was to avoid using "other" too easily. But maybe we can rethink a bit the changelog sections, maybe add a few ones (e.g. deprecation warnings could be more visible?). Anyway for this case probably no need for a changelog entry, it's good to avoid a copy but probably not a huge performance improvement. |
saimn
left a comment
There was a problem hiding this comment.
Nice simplification, thanks @astrofrog !
The fix from #9958 is no longer required as with the new tiled compression module we convert each tile to bytes using
tobytes()which effectively returns contiguous bytes, before we pass the bytes to the various compression algorithms. I have removed the overall conversion of the data array to be C contiguous, and have adjusted the test to really check that it works with a couple of dtypes (with/without quantization which does a copy in itself) and for all the supported compression types.When passing non-contiguous arrays to
CompImageHDU, this should make things a bit more efficient memory-wise and also time wise, but also importantly will ensure thatCompImageHDU.datais not changed in-place.I don't think this needs a changelog entry - but this did make me wonder where performance improvements should go in the current changelog system -
otherentries can't be assigned to specific sub-packages, but maybe we should allow this?This addresses the second bullet point in #3895