This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 5103173
committed
Auto merge of rust-lang#117179 - Voultapher:fix-useless-comp-in-partition-equal, r=Mark-Simulacrum
Avoid unnecessary comparison in partition_equal
The branchy Hoare partition `partition_equal` as part of `slice::sort_unstable` has a bug that makes it perform a comparison of the last element twice.
Measuring inputs with a Zipfian distribution with characterizing exponent s == 1.0, yields a ~0.05% reduction in the total number of comparisons performed.1 file changed
+10
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
631 | 636 | | |
632 | 637 | | |
633 | | - | |
| 638 | + | |
634 | 639 | | |
635 | 640 | | |
636 | 641 | | |
| |||
643 | 648 | | |
644 | 649 | | |
645 | 650 | | |
646 | | - | |
| 651 | + | |
647 | 652 | | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
648 | 656 | | |
649 | 657 | | |
650 | 658 | | |
| |||
653 | 661 | | |
654 | 662 | | |
655 | 663 | | |
656 | | - | |
657 | 664 | | |
658 | 665 | | |
659 | 666 | | |
| |||
0 commit comments