Use non-overlapping swap for inner heapsort loop
This regresses binary-size slightly for normal builds, but the important release_lto_thin_opt_level_s config sees a small improvement in binary-size and a larger types such as string and 1k see 2-3% run-time improvements with this change.
This commit is contained in:
parent
a0e4303ba2
commit
5439198348
1 changed files with 1 additions and 3 deletions
|
|
@ -69,9 +69,7 @@ where
|
|||
break;
|
||||
}
|
||||
|
||||
// Swap `node` with the greater child, move one step down, and continue sifting. This
|
||||
// could be ptr::swap_nonoverlapping but that adds a significant amount of binary-size.
|
||||
ptr::swap(v_base.add(node), v_base.add(child));
|
||||
ptr::swap_nonoverlapping(v_base.add(node), v_base.add(child), 1);
|
||||
}
|
||||
|
||||
node = child;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue