So I’ve made a basic pathfinding job, its single threaded bursted currently as I want to get it down as far as possible like that first. But while it does take quite a while in general there’s a sudden jump and increase in time it takes when a certain number is added.
For example it takes 101ms average in a grid space of 18 cells but then it jumps to 610ms at 20cells. Below 18 the values are reasonable and increase in a linear manner, but I don’t understand the jump from 18 to 20 and how it increases so exponentially.
I have just a general question, and a specific, how do I figure out in general why and how this is happening. Do I have to read the burst assembly language(please don’t say I have to read assembly language). I can use markers and stuff to drill down to exactly where the time is being taken but it still doesn’t tell me exactly why and what to do about it. I guess I don’t know enough about profiling and optimizing in general but jobs seem even harder and the information is pretty scant and vague currently. Anyway any advice is appreciated so I can nail this down, I’ll post the job if anyone has any detailed insights as to why its taking so long.
Entities
.ForEach((in AllySelectedDat Allydudes) =>
{
CellData neigborCelldata = new CellData();
for (int e = 0; e < PotentialMoveCells.Length; e++)
{
indicesToCheck.Clear();
for(int p = 0; p < PotentialMoveCells.Length; p++)
{
var tempwhy = PotentialMoveCells[p];
tempwhy.bestCost = byte.MaxValue;
if (tempwhy.cost != 255)
{
tempwhy.cost = 1;
}
PotentialMoveCells[p] = tempwhy;
}
var Tempdesination = PotentialMoveCells[e];
Tempdesination.bestCost = 0;
Tempdesination.cost = 0;
PotentialMoveCells[e] = Tempdesination;
indicesToCheck.Enqueue(Tempdesination);
while (indicesToCheck.Count > 0)
{
CellData curcellDat = indicesToCheck.Dequeue();
var deneigbors = GridCellHelperStuff.GetNeighbours(curcellDat.gridIndex, jobflowfieldat.gridSize.y);
foreach(int2 neigh in deneigbors)
{
neigborCelldata = new CellData();
var cachepotent = 0;
for(int i = 0; i < PotentialMoveCells.Length; i++)
{
if(neigh.Equals(PotentialMoveCells[i].gridIndex))
{
neigborCelldata = PotentialMoveCells[i];
cachepotent = i;
}
}
if (neigborCelldata.cost + curcellDat.bestCost < neigborCelldata.bestCost)
{
neigborCelldata.bestCost = (ushort)(neigborCelldata.cost + curcellDat.bestCost);
indicesToCheck.Enqueue(neigborCelldata);
PotentialMoveCells[cachepotent] = neigborCelldata;
if(neigborCelldata.gridIndex.Equals(Allycurrpos.int2Val) && neigborCelldata.bestCost <= Allymovedat.intVal)
{
ConfirmMovePoints.Add(Tempdesination.gridIndex);
goto Whilend;
}
}
}
}
Whilend:;
}
}).Schedule();