BLI: Improve IndexMask::complement() performance #108331

Merged
Hans Goudey merged 15 commits from HooglyBoogly/blender:index-mask-complement-performance into main 2023-05-31 17:11:11 +02:00

15 Commits

Author SHA1 Message Date
Hans Goudey 19428c4b6f Add some special case tests, remove performance test 2023-05-31 11:04:12 -04:00
Hans Goudey 7f1433764c Add more O(1) checks from Jacques 2023-05-31 11:01:39 -04:00
Hans Goudey fde54ae1a9 Merge branch 'main' into index-mask-complement-performance 2023-05-31 10:04:07 -04:00
Hans Goudey 64d31f1b65 Slightly specialize get_size_before_gap 2023-05-30 19:18:59 -04:00
Hans Goudey edbe13209e Add a separate code path for small masks 2023-05-30 18:48:38 -04:00
Hans Goudey c2b75d0e90 Use a dynamic grain size 2023-05-30 17:28:20 -04:00
Hans Goudey 9a6ccb3770 Add multiple indices at the same time 2023-05-30 17:10:51 -04:00
Hans Goudey 83713fef3d Add r_ prefix 2023-05-30 16:53:18 -04:00
Hans Goudey d2b9825f0e Make performance test slower 2023-05-30 16:49:46 -04:00
Hans Goudey 2e40248801 Merge branch 'main' into index-mask-complement-performance 2023-05-30 16:43:16 -04:00
Hans Goudey f890f8e0c4 Improve normal test 2023-05-30 16:37:43 -04:00
Hans Goudey 38a061824b Make performance test 2023-05-30 16:37:27 -04:00
Hans Goudey 795c002f1a Merge branch 'main' into index-mask-complement-performance 2023-05-30 16:32:32 -04:00
Hans Goudey da708df74b Cleanup: Simplofy use of modifier eval context flags 2023-05-26 16:11:54 -04:00
Hans Goudey 339cf787c2 WIP: BLI: Improve IndexMask::complement() performance
Instead of reusing `from_predicate` and lookup in the source mask,
scan the mask once, inserting segments between the original indices.

Theoretically this improves the performance from O(N*log(N)) to O(N).
But with the small constant offset of the former, the improvement won't
be that nice.

TODO:
- More performance testing. I didn't see much change in the test code runtime.
2023-05-26 15:21:46 -04:00