Until this PR, we were iterating over the entire footprint, having zero'd out the before or after points as appropriate for the use. That was correct, but wasteful as we don't need to scan points in the inner loop that we're about to scan in the outer loop.
Along the way: I fixed the reverse scan to actually ... 🤦🏻 scan in reverse.
I also renamed & reorganized the code a bunch, aiming for clarity on top of performance. Also, removing some functions reduced the cythonize time (cython to C + compilation) by ~50%. 🎉
Highly Scientific Laptop Benchmark Results:
Total time for OpenCV comparison: 6min 3s
Time to cythonize: ~14s
The cythonize time was previously ~26s, and total time was ... I think ... ~7min. (Should time this later?..., for science 🔬 )
Until this PR, we were iterating over the entire footprint, having zero'd out the before or after points as appropriate for the use. That was correct, but wasteful as we don't need to scan points in the inner loop that we're about to scan in the outer loop.
Along the way: I fixed the reverse scan to actually ... 🤦🏻 scan in reverse.
I also renamed & reorganized the code a bunch, aiming for clarity on top of performance. Also, removing some functions reduced the cythonize time (cython to C + compilation) by ~50%. 🎉
Highly Scientific Laptop Benchmark Results: Total time for OpenCV comparison: 6min 3s Time to cythonize: ~14s
The cythonize time was previously ~26s, and total time was ... I think ... ~7min. (Should time this later?..., for science 🔬 )