diff --git a/packages/fork-choice/src/protoArray/computeDeltas.ts b/packages/fork-choice/src/protoArray/computeDeltas.ts index 09f2cf05f1f5..8301c1e77a75 100644 --- a/packages/fork-choice/src/protoArray/computeDeltas.ts +++ b/packages/fork-choice/src/protoArray/computeDeltas.ts @@ -19,7 +19,11 @@ export function computeDeltas( newBalances: EffectiveBalanceIncrements, equivocatingIndices: Set ): number[] { - const deltas = Array(numProtoNodes).fill(0); + const deltas = new Array(numProtoNodes); + for (let i = 0; i < numProtoNodes; i++) { + deltas[i] = 0; + } + // avoid creating new variables in the loop to potentially reduce GC pressure let oldBalance, newBalance: number; let currentIndex, nextIndex: number | null;