Home

Awesome

Simple-optimized-A-Pathfinder

License: MIT

A simple pathfinder that I tried to optimize the maximum as I can, and share what I've discovered :)

The idea was pretty simple, implement a simple A* Pathfinder and use Unity Profiler to try to optimize the best as I can, trying to reduce the GC and the MS from the method itself

Final result:

alt text

Steps Descriptions

Performance Comparison

Keep in mind that all the results bellow are made inside Unity Deep Profiler, so the real performance its probably better than this, I'm working on the profiler for real builds

ActionGCGetPath() MSGC to originalGC to previousGetPath() MS to originalGetPath() MS ToPreviousCommit
Original40,6 KB29,87 msOriginal File
Step 150,3 KB20,14 ms+23,89%+23,89%-32,57%-32,57%Commit
Step 250,3 KB16,95 ms+23,89%0%-43,25%-15,87%Commit
Step 336,2 KB16,92 ms-10,14%-28,03%-43,35%-0,18%Commit
Step 432 KB10,97 ms-21,18%-11,60%-63,27%-35,17%Commit
Step 532 KB9,91 ms-21,18%0%-66,82%-9,66%Commit
Step 632 KB10,11 ms-21,18%0%-66,15%-2,02%Commit
Step 722,1 KB7,53 ms-45,57%-30,94%-74,79%-25,52%Commit
Step 822,1 KB7,46 ms-45,57%0%-75,03%-0,93%Commit
Step 912,6 KB7,46 ms-68,97%-42,99%-75,03%0%Commit
Step 1012,6 KB7,32 ms-68,97%0%-75,49%-1,88%Commit
Step 114,2 KB6,59 ms-89,66%-66,67%-77,94%-9,97%Commit
Step 120 KB4,82 ms-100%-100%-83,86%-26,86%Commit

profiler