Try optimizing the pathfinder speed today. A few quick profiling showed over 80% of all A* processing time spent on the data collection class itself (SortedTreeNode), with 60% spent on searching the nodes for best value and 30% in data removal;
- Replace List class array with more flexible (if higher memory usage) LinkedList.
- Implement insertion sort (O(n)) for the data collector, so that recalling data could be done with constant O(1). A quick profiling show shifts in processing time; Node adding function (AddLeave) now take highest place at 54% processing time, with 20% of that spent in just comparing the weight values. Measured biggest spike at ~480ms with 1283 calls to AddLeave() function.
- Replace cumbersome IComparer class with sleeker IComparable, getting rid of another layer of function call. Weight conparison time somehow jump to 33%, but biggest spike measured at only ~300ms with only 922 calls to AddLeave(). Although the the software was experiencing Out-of-Memory problem during the test.
- Optimize weight data structure, replacing complex data comparison with a single integer. Node adding function (AddLeave) processing time dropped to mere 40% from 60% in the last step, and data comparison got a massive drop from 33% to 1%. Overall computation took ~200ms with over 1327 calls to AddLeave() function. I call that a success for the moment.
Overall result; Time spent on pathfinding algorithm seems to be reduced by approximately 20 – 25%