Skip to content

Commit 6f62abb

Browse files
authored
Remove usage of Array#fill (#20071)
1 parent 40cfe1f commit 6f62abb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎packages/react-reconciler/src/ReactFiberLane.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,13 @@ export function higherLanePriority(
640640
}
641641

642642
exportfunctioncreateLaneMap<T>(initial: T): LaneMap<T>{
643-
returnnewArray(TotalLanes).fill(initial);
643+
// Intentionally pushing one by one.
644+
// https://v8.dev/blog/elements-kinds#avoid-creating-holes
645+
constlaneMap=[];
646+
for(leti=0;i<TotalLanes;i++){
647+
laneMap.push(initial);
648+
}
649+
return laneMap;
644650
}
645651

646652
exportfunctionmarkRootUpdated(

0 commit comments

Comments
 (0)