about summary refs log tree commit diff
path: root/src/test/run-pass/thinlto
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-07-01 13:31:32 +0000
committerbors <bors@rust-lang.org>2017-07-01 13:31:32 +0000
commit05b5797664d6aeaa0c7d0606610f336fe0b57e97 (patch)
tree258baa2269a023f726ce232fd3841bf5f8567ae2 /src/test/run-pass/thinlto
parenta5d34e1d035e5441fb5b3d56d5205d038538f053 (diff)
parent723833f4e1ab867e9dafc7fed863321d96d507e8 (diff)
downloadrust-05b5797664d6aeaa0c7d0606610f336fe0b57e97.tar.gz
rust-05b5797664d6aeaa0c7d0606610f336fe0b57e97.zip
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
Diffstat (limited to 'src/test/run-pass/thinlto')
0 files changed, 0 insertions, 0 deletions