Repository navigation
DM-57102: Merge mask planes in bulk in Mask.update - #116
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #116 +/- ##
==========================================
+ Coverage 66.22% 66.31% +0.09%
==========================================
Files 159 159
Lines 24201 24248 +47
==========================================
+ Hits 16028 16081 +53
+ Misses 8173 8167 -6 ☔ View full report in Codecov by Harness. |
|
@TallJimbo the real question is if you want to trade the 1 second saving in read time for code complexity. From the end-user point of view this is a big saving when looking at notebooks, but I also imagine that these seconds add up during DRP and even Prompt Processing once we are using native lsst.images. |
TallJimbo
left a comment
There was a problem hiding this comment.
Yes, I think we definitely make the trade for speed here, and I expect that to happen in other places, too. I think the right policy here is something along the lines of "use the simple boolean operators unless profiling says it matters for big-picture performance", and here it clearly does.
Mask.update copied each shared plane with a boolean read and a fancy-indexed write, about 70 ms per plane on a 4k x 4k mask. Planes that move by the same bit shift between the same pair of array elements are now copied with a single shift-and-OR. Reading a LSSTCam visit image, whose mask is stored as one int32 plane, drops from 1.84 s to 0.75 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2ea75dc to
5d343d5
Compare
Mask.update copied each shared plane with a boolean read and a fancy-indexed write, about 70 ms per plane on a 4k x 4k mask. Planes that move by the same bit shift between the same pair of array elements are now copied with a single shift-and-OR. Reading a LSSTCam visit image, whose mask is stored as one int32 plane, drops from 1.84 s to 0.75 s.
Checklist
doc/changes