John Cabral wrote:
I was working on some code for my game and read about the optimization of feeding a list of rects to the update function. I was curious if it would be worthwhile to try to optimize the list that is fed to the function. Specifically, I would try to shorten the list by merging rects that had significant areas of overlap. However, I can't tell if the function itself might perform this work itself. Does anyone know?
I've found that generally many small rectangles aren't slower than fewer big ones. The most important thing is the area effected.
And yes, overlapping rectangles are processed multiple times, so that can cost big on performance. A little effort to keep big areas from overlapping will pay off.