rust/src/libcollections
bors 8a813e088c Auto merge of #29675 - bluss:merge-sort-fastpath, r=huonw
sort: Fast path for already sorted data

When merging two sorted blocks `left` and `right` if the last element in
`left` is <= the first in `right`, the blocks are already in sorted order.

Add this as an additional fast path by simply copying the whole left
block into the output and advancing the left pointer. The right block is
then treated the same way by the already present logic in the merge
loop.

Can reduce runtime of .sort() to less than 50% of the previous, if the data
was already perfectly sorted. Sorted data with a few swaps are also
sorted quicker than before. The overhead of one comparison per merge
seems to be negligible.
2015-11-13 01:44:58 +00:00
..
btree libcollections: deny warnings in doctests 2015-11-12 05:15:55 +00:00
binary_heap.rs libcollections: deny warnings in doctests 2015-11-12 05:15:55 +00:00
borrow.rs libcollections: deny warnings in doctests 2015-11-12 05:15:55 +00:00
enum_set.rs Simplify Debug for {EnumSet, VecDeque} 2015-09-25 12:03:03 -04:00
fmt.rs libcollections: deny warnings in doctests 2015-11-12 05:15:55 +00:00
lib.rs libcollections: deny warnings in doctests 2015-11-12 05:15:55 +00:00
linked_list.rs Remove stability annotations from trait impl items 2015-11-06 00:13:46 +03:00
macros.rs Add note about clone in docs for vec![] 2015-09-07 03:57:20 +05:30
range.rs collections: Add issues for unstable features 2015-08-15 18:09:17 -07:00
slice.rs Auto merge of #29675 - bluss:merge-sort-fastpath, r=huonw 2015-11-13 01:44:58 +00:00
str.rs libcollections: deny warnings in doctests 2015-11-12 05:15:55 +00:00
string.rs libcollections: deny warnings in doctests 2015-11-12 05:15:55 +00:00
vec.rs libcollections: deny warnings in doctests 2015-11-12 05:15:55 +00:00
vec_deque.rs Correct incorrect assertion in VecDeque::wrap_copy 2015-11-03 13:03:36 -05:00