SebLague / Pathfinding

MIT License
668 stars 251 forks source link

Increase algoritm speed and threading fix #13

Open Ceeeeed opened 3 years ago

Ceeeeed commented 3 years ago

Hi. I've made two minor changes:

  1. threadStart.Invoke(); to new Thread(threadStart).Start();. The first one does not create a new thread.

  2. List<Node> neighbours = new List<Node>(); to neighbours.Clear(); (now this list is a field). GetNeighbours() method is called quite often during path searching, so creating new list every time slows down the algorithm a lot. For me it's 20-25% faster after this change.

Updated A* tutorial using DOTS would be great. Cheers!