]> git.itanic.dy.fi Git - sdl-planets/commit
quadtree: Optimize recalculate_parent_area_stats()
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Tue, 19 Jul 2011 17:10:14 +0000 (20:10 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Tue, 19 Jul 2011 17:10:14 +0000 (20:10 +0300)
commit466216f90330cccb2db509f828172a3ccece7c86
tree3984cb6549abeda8c22750fca2e3436f7515ea1c
parenta36c6583ae1f860989959e2dd606fb90504e7beb
quadtree: Optimize recalculate_parent_area_stats()

There is no need to go through the entire tree in case one leaf node
has a minimal change in it. As long as we have gone high enough in the
tree that there is no more any changes to the corner vectors, we can
stop walking the tree up. According to perf measurements, this
optimization reduces the tree area recalculation overhead about 50%.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
quadtree.c