Barsonax / Pathfindax

Pathfinding framework
GNU Affero General Public License v3.0
26 stars 8 forks source link

Optimize MaxHeap #56

Closed Barsonax closed 6 years ago

Barsonax commented 6 years ago

Summary

The MaxHeap plays a major role in the performance of the pathfinding algorithms as its used as a priority queue. Some micro benchmarking has shown that storing the result of a property in a local variable can significantly increase performance of the MaxHeap. The compiler probably cannot guarantee the values of the properties do not change and thus cannot optimize them properly.

See if there are any redundant property accesses and optimize these away. Microbenchmarks already have shown significant improvement so measure the result by measuring the performance gains in the pathfind algorithms.

Barsonax commented 6 years ago

In the micro benchmarks for MaxHeap we went from: image

To: image Which is a solid improvement over the old situation.

Real life benchmarks showed that the AstarAlgorithm is now also slightly (10-20%) faster than it used to be.