Compare commits

...

1 Commits

Author SHA1 Message Date
Dan Abramov
8e5adfbd7e Remove usage of Array#fill (#20071) 2020-10-22 12:59:20 +01:00

View File

@@ -640,7 +640,13 @@ export function higherLanePriority(
}
export function createLaneMap<T>(initial: T): LaneMap<T> {
return new Array(TotalLanes).fill(initial);
// Intentionally pushing one by one.
// https://v8.dev/blog/elements-kinds#avoid-creating-holes
const laneMap = [];
for (let i = 0; i < TotalLanes; i++) {
laneMap.push(initial);
}
return laneMap;
}
export function markRootUpdated(