@@ -1064,11 +1064,17 @@ impl<T> [T] {
10641064
10651065 /// This is equivalent to `self.sort_by(|a, b| a.cmp(b))`.
10661066 ///
1067- /// This sort is stable and `O(n log n)` worst-case.
1067+ /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
10681068 ///
1069- /// # Current Implementation
1069+ /// # Current implementation
10701070 ///
1071- /// The current implementation allocates temporary storage half the size of `self`.
1071+ /// The current algorithm is an adaptive, iterative merge sort inspired by
1072+ /// [timsort](https://en.wikipedia.org/wiki/Timsort).
1073+ /// It is designed to be very fast in cases where the slice is nearly sorted, or consists of
1074+ /// two or more sorted sequences concatenated one after another.
1075+ ///
1076+ /// Also, it allocates temporary storage half the size of `self`, but for short slices a
1077+ /// non-allocating insertion sort is used instead.
10721078 ///
10731079 /// # Examples
10741080 ///
@@ -1086,11 +1092,19 @@ impl<T> [T] {
10861092 self . sort_by ( |a, b| a. cmp ( b) )
10871093 }
10881094
1089- /// Sorts the slice, in place, using `f` to extract a key by which to
1090- /// order the sort by.
1095+ /// Sorts the slice using `f` to extract a key to compare elements by.
1096+ ///
1097+ /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
1098+ ///
1099+ /// # Current implementation
1100+ ///
1101+ /// The current algorithm is an adaptive, iterative merge sort inspired by
1102+ /// [timsort](https://en.wikipedia.org/wiki/Timsort).
1103+ /// It is designed to be very fast in cases where the slice is nearly sorted, or consists of
1104+ /// two or more sorted sequences concatenated one after another.
10911105 ///
1092- /// This sort is stable and `O(n log n)` worst-case , but allocates
1093- /// temporary storage half the size of `self` .
1106+ /// Also, it allocates temporary storage half the size of `self` , but for short slices a
1107+ /// non-allocating insertion sort is used instead .
10941108 ///
10951109 /// # Examples
10961110 ///
@@ -1108,11 +1122,19 @@ impl<T> [T] {
11081122 self . sort_by ( |a, b| f ( a) . cmp ( & f ( b) ) )
11091123 }
11101124
1111- /// Sorts the slice, in place, using `compare` to compare
1112- /// elements.
1125+ /// Sorts the slice using `compare` to compare elements.
1126+ ///
1127+ /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
1128+ ///
1129+ /// # Current implementation
1130+ ///
1131+ /// The current algorithm is an adaptive, iterative merge sort inspired by
1132+ /// [timsort](https://en.wikipedia.org/wiki/Timsort).
1133+ /// It is designed to be very fast in cases where the slice is nearly sorted, or consists of
1134+ /// two or more sorted sequences concatenated one after another.
11131135 ///
1114- /// This sort is stable and `O(n log n)` worst-case , but allocates
1115- /// temporary storage half the size of `self` .
1136+ /// Also, it allocates temporary storage half the size of `self` , but for short slices a
1137+ /// non-allocating insertion sort is used instead .
11161138 ///
11171139 /// # Examples
11181140 ///
0 commit comments