Small optimization (!248)

Change `foreach` to use `for of` instead, `for of` is faster than `foreach`

Co-authored-by: Cj <161484149+CJ-SPT@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/248
Co-authored-by: Cj <cj@noreply.dev.sp-tarkov.com>
Co-committed-by: Cj <cj@noreply.dev.sp-tarkov.com>
This commit is contained in:
Cj 2024-03-06 19:50:45 +00:00 committed by chomp
parent 96bace1288
commit 2249337a02

View File

@ -887,10 +887,11 @@ export class QuestController
childItems.shift(); // Remove the parent childItems.shift(); // Remove the parent
// Sort by the current `location` and update // Sort by the current `location` and update
childItems.sort((a, b) => a.location > b.location ? 1 : -1).forEach((item, index) => childItems.sort((a, b) => a.location > b.location ? 1 : -1);
for (const [index, item] of childItems.entries())
{ {
item.location = index; item.location = index;
}); }
} }
} }
} }