mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Removes lag from AStar() (#17308)
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.
This commit is contained in:
committed by
KorPhaeron
parent
9274c245bc
commit
c1df58be0d
@@ -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
|
||||
@@ -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)
|
||||
@@ -178,4 +177,4 @@ Actual Adjacent procs :
|
||||
if(!O.CanAStarPass(ID, rdir, caller))
|
||||
return 1
|
||||
|
||||
return 0
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user