Saturday, December 11, 2010

Mesh Levels

Got some various debugging info in place and finally decided to get some stats on the various levels of the map build.

Build Data
Level Cells Avg. Distance Time (ms)
0 12 1.051462 56
2 92 0.396275 243
4 252 0.2403322 1264
6 492 0.1721796 3594
8 812 0.1340831 11187
10 1212 0.1097718 19649
12 1692 0.09291888 34545

The cells increase at a slight exponential rate while the time at a much steeper rate. The generating code could be a lot more optimal, and the vast majority of this time is spent in the mesh generate. Each cell is locally subdivided down three levels. There are probably a lot of optimizations that could be run, and a couple of the loops could be consolidated. Over time I've managed to optimize most loops to just n * n.neighbors. I've opted more for understandable code (as much as possible) vs highly optimized loops. Considering that all of this is done once at compile time, it's not a big deal really.





1 comment: