Re:Going Faster by Duplicating Code
by voidstarcpp on Tuesday October 10, 2023 @10:02PM
(#37840112)
Addressing the aliasing concern would be the easiest improvement. I observed in the assembly that the source pixel is being re-read all four times it is used, which could be fixed.
Writing an optimal composite function is of course not really the goal, nor of much educational/entertainment value. For any additional speed I already have a function which slices up compositing tasks into chunks and puts them on a thread pool.
1. using `restrict` to tell that compiler that src and dest are sure not to overlap
2. Converting your two increment and test blocks to add+mod to allow for uninterrupted pipelining
Neither might make a difference, but either could.