@@ -355,7 +355,7 @@ fn partition<T, F>(v: &mut [T], pivot: usize, is_less: &mut F) -> (usize, bool)
355355 l += 1 ;
356356 }
357357
358- // Find the last element lesser that the pivot.
358+ // Find the last element smaller that the pivot.
359359 while l < r && !is_less ( v. get_unchecked ( r - 1 ) , pivot) {
360360 r -= 1 ;
361361 }
@@ -472,7 +472,7 @@ fn choose_pivot<T, F>(v: &mut [T], is_less: &mut F) -> (usize, bool)
472472{
473473 // Minimal length to choose the median-of-medians method.
474474 // Shorter slices use the simple median-of-three method.
475- const SHORTEST_MEDIAN_OF_MEDIANS : usize = 90 ;
475+ const SHORTEST_MEDIAN_OF_MEDIANS : usize = 80 ;
476476 // Maximal number of swaps that can be performed in this function.
477477 const MAX_SWAPS : usize = 4 * 3 ;
478478
@@ -539,7 +539,7 @@ fn recurse<'a, T, F>(mut v: &'a mut [T], is_less: &mut F, mut pred: Option<&'a T
539539 where F : FnMut ( & T , & T ) -> bool
540540{
541541 // Slices of up to this length get sorted using insertion sort.
542- const MAX_INSERTION : usize = 16 ;
542+ const MAX_INSERTION : usize = 20 ;
543543
544544 // True if the last partitioning was reasonably balanced.
545545 let mut was_balanced = true ;
@@ -627,8 +627,8 @@ pub fn quicksort<T, F>(v: &mut [T], mut is_less: F)
627627 return ;
628628 }
629629
630- // Limit the number of imbalanced partitions to `floor(log2(len)) + 2 `.
631- let limit = mem:: size_of :: < usize > ( ) * 8 - v. len ( ) . leading_zeros ( ) as usize + 1 ;
630+ // Limit the number of imbalanced partitions to `floor(log2(len)) + 1 `.
631+ let limit = mem:: size_of :: < usize > ( ) * 8 - v. len ( ) . leading_zeros ( ) as usize ;
632632
633633 recurse ( v, & mut is_less, None , limit) ;
634634}
0 commit comments