Skip to content

Commit 7309c5f

Browse files
yisaracdlite
authored andcommitted
Use zero-fill right shift instead of Math.floor (#17616)
For positive numbers, binary displacement is better.
1 parent 9bb3fbe commit 7309c5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/scheduler/src/SchedulerMinHeap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function pop(heap: Heap): Node | null {
4141
function siftUp(heap, node, i) {
4242
let index = i;
4343
while (true) {
44-
const parentIndex = Math.floor((index - 1) / 2);
44+
const parentIndex = (index - 1) >>> 1;
4545
const parent = heap[parentIndex];
4646
if (parent !== undefined && compare(parent, node) > 0) {
4747
// The parent is larger. Swap positions.

0 commit comments

Comments
 (0)