rust/src/liballoc
bors 05b5797664 Auto merge of #42882 - stjepang:improve-sort-tests-and-benches, r=alexcrichton
Improve tests and benchmarks for slice::sort and slice::sort_unstable

This PR just hardens the tests and improves benchmarks.
More specifically:

1. Benchmarks don't generate vectors in `Bencher::iter` loops, but simply clone pregenerated vectors.
2. Benchmark `*_strings` doesn't allocate Strings in `Bencher::iter` loops, but merely clones a `Vec<&str>`.
3. Benchmarks use seeded `XorShiftRng` to be more consistent.
4. Additional tests for `slice::sort` are added, which test sorting on slices with several ascending/descending runs. The implementation identifies such runs so it's a good idea to test that scenario a bit.
5. More checks are added to `run-pass/vector-sort-panic-safe.rs`. Sort algorithms copy elements around a lot (merge sort uses an auxilliary buffer and pdqsort copies the pivot onto the stack before partitioning, then writes it back into the slice). If elements that are being sorted are internally mutable and comparison function mutates them, it is important to make sure that sort algorithms always use the latest "versions" of elements. New checks verify that this is true for both `slice::sort` and `slice::sort_unstable`.

As a side note, all of those improvements were made as part of the parallel sorts PR in Rayon (nikomatsakis/rayon#379) and now I'm backporting them into libcore/libstd.

r? @alexcrichton
2017-07-01 13:31:32 +00:00
..
benches Improve sort tests and benchmarks 2017-06-24 17:14:42 +02:00
btree Revert "Stabilize RangeArgument" 2017-06-30 08:34:53 -10:00
tests Improve sort tests and benchmarks 2017-06-24 17:14:42 +02:00
allocator.rs std: Fix implementation of Alloc::alloc_one 2017-06-25 11:35:05 -07:00
arc.rs Merge crate collections into alloc 2017-06-13 23:37:34 -07:00
binary_heap.rs Merge crate collections into alloc 2017-06-13 23:37:34 -07:00
borrow.rs Merge crate collections into alloc 2017-06-13 23:37:34 -07:00
boxed.rs Removed as many "```ignore" as possible. 2017-06-23 15:31:53 +08:00
boxed_test.rs Direct conversions between slices and boxes. 2017-02-06 18:53:13 -05:00
Cargo.toml Merge crate collections into alloc 2017-06-13 23:37:34 -07:00
fmt.rs Rollup merge of #42832 - rthomas:doc-fmt, r=steveklabnik 2017-06-29 08:40:03 +00:00
heap.rs Add impl of Alloc for the global rust heap. 2017-06-15 23:48:30 +02:00
lib.rs Revert "Stabilize RangeArgument" 2017-06-30 08:34:53 -10:00
linked_list.rs Merge crate collections into alloc 2017-06-13 23:37:34 -07:00
macros.rs Merge crate collections into alloc 2017-06-13 23:37:34 -07:00
oom.rs drop an unnecessary newline 2016-11-10 23:44:15 -05:00
range.rs Revert "Stabilize RangeArgument" 2017-06-30 08:34:53 -10:00
raw_vec.rs Removed as many "```ignore" as possible. 2017-06-23 15:31:53 +08:00
rc.rs Fix ref as mutable ref in std::rc::Rc doc 2017-06-22 15:48:20 +02:00
slice.rs Improve sort tests and benchmarks 2017-06-24 17:14:42 +02:00
str.rs Merge crate collections into alloc 2017-06-13 23:37:34 -07:00
string.rs Revert "Stabilize RangeArgument" 2017-06-30 08:34:53 -10:00
vec.rs Revert "Stabilize RangeArgument" 2017-06-30 08:34:53 -10:00
vec_deque.rs Revert "Stabilize RangeArgument" 2017-06-30 08:34:53 -10:00