about summary refs log tree commit diff
path: root/src/liballoc/slice.rs
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-03-01 12:15:05 +0000
committervarkor <github@varkor.com>2018-03-16 13:57:07 +0000
commit670e69e20753e2ef33ee61b0515092cace3fd716 (patch)
tree47a287b37c27519eddcea084224e5bbaab9acb0b /src/liballoc/slice.rs
parentea6a1bdf6ba754f3b96e3a46f9173b17ff18ed07 (diff)
downloadrust-670e69e20753e2ef33ee61b0515092cace3fd716.tar.gz
rust-670e69e20753e2ef33ee61b0515092cace3fd716.zip
Update documentation for sort_by_key
Diffstat (limited to 'src/liballoc/slice.rs')
-rw-r--r--src/liballoc/slice.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs
index c57f1e7f572..db3b14859dd 100644
--- a/src/liballoc/slice.rs
+++ b/src/liballoc/slice.rs
@@ -1302,11 +1302,9 @@ impl<T> [T] {
 
     /// Sorts the slice with a key extraction function.
     ///
-    /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
-    ///
-    /// When applicable, unstable sorting is preferred because it is generally faster than stable
-    /// sorting and it doesn't allocate auxiliary memory.
-    /// See [`sort_unstable_by_key`](#method.sort_unstable_by_key).
+    /// During sorting, the key function is called only once per element.
+    /// This sort is stable (i.e. does not reorder equal elements) and `O(m n + n log n)`
+    /// worst-case, where the key function is `O(m)`.
     ///
     /// # Current implementation
     ///
@@ -1315,8 +1313,7 @@ impl<T> [T] {
     /// It is designed to be very fast in cases where the slice is nearly sorted, or consists of
     /// two or more sorted sequences concatenated one after another.
     ///
-    /// Also, it allocates temporary storage half the size of `self`, but for short slices a
-    /// non-allocating insertion sort is used instead.
+    /// The algorithm allocates temporary storage the size of `self`.
     ///
     /// # Examples
     ///