@@ -781,13 +781,15 @@ fn recurse<'a, T, F>(
781
781
// Very short slices get sorted using insertion sort.
782
782
if len <= MAX_INSERTION {
783
783
insertion_sort ( v, is_less) ;
784
+ pbar. inc ( len as u64 ) ;
784
785
return ;
785
786
}
786
787
787
788
// If too many bad pivot choices were made, simply fall back to heapsort in order to
788
789
// guarantee `O(n * log(n))` worst-case.
789
790
if limit == 0 {
790
791
heapsort ( v, is_less) ;
792
+ pbar. inc ( len as u64 ) ;
791
793
return ;
792
794
}
793
795
@@ -807,6 +809,7 @@ fn recurse<'a, T, F>(
807
809
// Try identifying several out-of-order elements and shifting them to correct
808
810
// positions. If the slice ends up being completely sorted, we're done.
809
811
if partial_insertion_sort ( v, is_less) {
812
+ pbar. inc ( len as u64 ) ;
810
813
return ;
811
814
}
812
815
}
@@ -847,7 +850,6 @@ fn recurse<'a, T, F>(
847
850
v = left;
848
851
}
849
852
} else {
850
- pbar. inc ( 1 ) ;
851
853
// Sort the left and right half in parallel.
852
854
rayon_core:: join (
853
855
|| recurse ( left, is_less, pred, limit, pbar) ,
@@ -874,7 +876,8 @@ where
874
876
// Limit the number of imbalanced partitions to `floor(log2(len)) + 1`.
875
877
let limit = usize:: BITS - v. len ( ) . leading_zeros ( ) ;
876
878
let pbar = if verbose {
877
- let p = ProgressBar :: new ( ( v. len ( ) as f64 / 2000.0 ) . ceil ( ) as u64 ) ;
879
+ // increment progression after each MAX_SEQUENTIAL length slice is sorted
880
+ let p = ProgressBar :: new ( v. len ( ) as u64 ) ;
878
881
p. set_style (
879
882
ProgressStyle :: with_template (
880
883
"{elapsed} elapsed (estimated duration {duration}) {bar:80}" ,
0 commit comments