Skip to content

Commit

Permalink
Removes lag from AStar() (tgstation#17308)
Browse files Browse the repository at this point in the history
On sybil, during a round, lag happened and this was at the top of the profile (no idea if this is the actual cause, but the profile i took on sybil 10 minute before didn't have it at the top), the avg run time was ~2ds per run, meaning each astar call leads to about 4 byond ticks getting lost. I suspect that most calls to AStar are much less and that this was certain extreme edge cases taking a long amount.
  • Loading branch information
MrStonedOne authored and KorPhaeron committed May 9, 2016
1 parent 9274c24 commit c1df58b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions code/orphaned procs/AStar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ Actual Adjacent procs :

//then run the main loop
while(!open.IsEmpty() && !path)
{
//get the lower f node on the open list
cur = open.Pop() //get the lower f turf in the open list
closed.Add(cur.source) //and tell we've processed it
Expand Down Expand Up @@ -133,8 +132,8 @@ Actual Adjacent procs :
T.PNode.calc_f()
T.PNode.nt = cur.nt + 1
open.ReSort(T.PNode)//reorder the changed element in the list
CHECK_TICK

}

//cleaning after us
for(var/PathNode/PN in open.L)
Expand Down Expand Up @@ -178,4 +177,4 @@ Actual Adjacent procs :
if(!O.CanAStarPass(ID, rdir, caller))
return 1

return 0
return 0

0 comments on commit c1df58b

Please sign in to comment.