Skip to content

Commit 670e69e

Browse files
committed
Update documentation for sort_by_key
1 parent ea6a1bd commit 670e69e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/liballoc/slice.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,11 +1302,9 @@ impl<T> [T] {
13021302

13031303
/// Sorts the slice with a key extraction function.
13041304
///
1305-
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
1306-
///
1307-
/// When applicable, unstable sorting is preferred because it is generally faster than stable
1308-
/// sorting and it doesn't allocate auxiliary memory.
1309-
/// See [`sort_unstable_by_key`](#method.sort_unstable_by_key).
1305+
/// During sorting, the key function is called only once per element.
1306+
/// This sort is stable (i.e. does not reorder equal elements) and `O(m n + n log n)`
1307+
/// worst-case, where the key function is `O(m)`.
13101308
///
13111309
/// # Current implementation
13121310
///
@@ -1315,8 +1313,7 @@ impl<T> [T] {
13151313
/// It is designed to be very fast in cases where the slice is nearly sorted, or consists of
13161314
/// two or more sorted sequences concatenated one after another.
13171315
///
1318-
/// Also, it allocates temporary storage half the size of `self`, but for short slices a
1319-
/// non-allocating insertion sort is used instead.
1316+
/// The algorithm allocates temporary storage the size of `self`.
13201317
///
13211318
/// # Examples
13221319
///

0 commit comments

Comments
 (0)