Skip to content

Commit 4379e2f

Browse files
committed
Auto merge of #39645 - frewsxcv:rollup, r=frewsxcv
Rollup of 11 pull requests - Successful merges: #39462, #39512, #39529, #39557, #39561, #39582, #39583, #39597, #39622, #39624, #39630 - Failed merges:
2 parents 10f6a5c + 62d2267 commit 4379e2f

File tree

58 files changed

+1922
-1606
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1922
-1606
lines changed

RELEASES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version 1.15.1 (2017-02-07)
1+
Version 1.15.1 (2017-02-08)
22
===========================
33

44
* [Fix IntoIter::as_mut_slice's signature][39466]

src/bootstrap/clean.rs

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use Build;
2424
pub fn clean(build: &Build) {
2525
rm_rf(build, "tmp".as_ref());
2626
rm_rf(build, &build.out.join("tmp"));
27+
rm_rf(build, &build.out.join("dist"));
2728

2829
for host in build.config.host.iter() {
2930
let entries = match build.out.join(host).read_dir() {

src/libcollections/Cargo.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ std_unicode = { path = "../libstd_unicode" }
1616
name = "collectionstest"
1717
path = "../libcollectionstest/lib.rs"
1818

19-
# FIXME: need to extract benchmarks to separate crate
20-
#[[bench]]
21-
#name = "collectionstest"
22-
#path = "../libcollectionstest/lib.rs"
19+
[[bench]]
20+
name = "collectionsbenches"
21+
path = "../libcollections/benches/lib.rs"

src/libcollectionstest/bench.rs src/libcollections/benches/btree/map.rs

+54-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,13 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
12+
use std::iter::Iterator;
13+
use std::vec::Vec;
14+
use std::collections::BTreeMap;
15+
use std::__rand::{Rng, thread_rng};
16+
use test::{Bencher, black_box};
17+
1118
macro_rules! map_insert_rand_bench {
1219
($name: ident, $n: expr, $map: ident) => (
1320
#[bench]
14-
pub fn $name(b: &mut ::test::Bencher) {
15-
use std::__rand::{thread_rng, Rng};
16-
use test::black_box;
17-
21+
pub fn $name(b: &mut Bencher) {
1822
let n: usize = $n;
1923
let mut map = $map::new();
2024
// setup
@@ -39,9 +43,7 @@ macro_rules! map_insert_rand_bench {
3943
macro_rules! map_insert_seq_bench {
4044
($name: ident, $n: expr, $map: ident) => (
4145
#[bench]
42-
pub fn $name(b: &mut ::test::Bencher) {
43-
use test::black_box;
44-
46+
pub fn $name(b: &mut Bencher) {
4547
let mut map = $map::new();
4648
let n: usize = $n;
4749
// setup
@@ -64,12 +66,7 @@ macro_rules! map_insert_seq_bench {
6466
macro_rules! map_find_rand_bench {
6567
($name: ident, $n: expr, $map: ident) => (
6668
#[bench]
67-
pub fn $name(b: &mut ::test::Bencher) {
68-
use std::iter::Iterator;
69-
use std::__rand::{thread_rng, Rng};
70-
use std::vec::Vec;
71-
use test::black_box;
72-
69+
pub fn $name(b: &mut Bencher) {
7370
let mut map = $map::new();
7471
let n: usize = $n;
7572

@@ -97,9 +94,7 @@ macro_rules! map_find_rand_bench {
9794
macro_rules! map_find_seq_bench {
9895
($name: ident, $n: expr, $map: ident) => (
9996
#[bench]
100-
pub fn $name(b: &mut ::test::Bencher) {
101-
use test::black_box;
102-
97+
pub fn $name(b: &mut Bencher) {
10398
let mut map = $map::new();
10499
let n: usize = $n;
105100

@@ -118,3 +113,45 @@ macro_rules! map_find_seq_bench {
118113
}
119114
)
120115
}
116+
117+
map_insert_rand_bench!{insert_rand_100, 100, BTreeMap}
118+
map_insert_rand_bench!{insert_rand_10_000, 10_000, BTreeMap}
119+
120+
map_insert_seq_bench!{insert_seq_100, 100, BTreeMap}
121+
map_insert_seq_bench!{insert_seq_10_000, 10_000, BTreeMap}
122+
123+
map_find_rand_bench!{find_rand_100, 100, BTreeMap}
124+
map_find_rand_bench!{find_rand_10_000, 10_000, BTreeMap}
125+
126+
map_find_seq_bench!{find_seq_100, 100, BTreeMap}
127+
map_find_seq_bench!{find_seq_10_000, 10_000, BTreeMap}
128+
129+
fn bench_iter(b: &mut Bencher, size: i32) {
130+
let mut map = BTreeMap::<i32, i32>::new();
131+
let mut rng = thread_rng();
132+
133+
for _ in 0..size {
134+
map.insert(rng.gen(), rng.gen());
135+
}
136+
137+
b.iter(|| {
138+
for entry in &map {
139+
black_box(entry);
140+
}
141+
});
142+
}
143+
144+
#[bench]
145+
pub fn iter_20(b: &mut Bencher) {
146+
bench_iter(b, 20);
147+
}
148+
149+
#[bench]
150+
pub fn iter_1000(b: &mut Bencher) {
151+
bench_iter(b, 1000);
152+
}
153+
154+
#[bench]
155+
pub fn iter_100000(b: &mut Bencher) {
156+
bench_iter(b, 100000);
157+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
mod map;

src/libcollections/benches/lib.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![deny(warnings)]
12+
13+
#![feature(rand)]
14+
#![feature(test)]
15+
16+
extern crate test;
17+
18+
mod btree;
19+
mod linked_list;
20+
mod string;
21+
mod str;
22+
mod slice;
23+
mod vec;
24+
mod vec_deque;
+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use std::collections::LinkedList;
12+
use test::Bencher;
13+
14+
#[bench]
15+
fn bench_collect_into(b: &mut Bencher) {
16+
let v = &[0; 64];
17+
b.iter(|| {
18+
let _: LinkedList<_> = v.iter().cloned().collect();
19+
})
20+
}
21+
22+
#[bench]
23+
fn bench_push_front(b: &mut Bencher) {
24+
let mut m: LinkedList<_> = LinkedList::new();
25+
b.iter(|| {
26+
m.push_front(0);
27+
})
28+
}
29+
30+
#[bench]
31+
fn bench_push_back(b: &mut Bencher) {
32+
let mut m: LinkedList<_> = LinkedList::new();
33+
b.iter(|| {
34+
m.push_back(0);
35+
})
36+
}
37+
38+
#[bench]
39+
fn bench_push_back_pop_back(b: &mut Bencher) {
40+
let mut m: LinkedList<_> = LinkedList::new();
41+
b.iter(|| {
42+
m.push_back(0);
43+
m.pop_back();
44+
})
45+
}
46+
47+
#[bench]
48+
fn bench_push_front_pop_front(b: &mut Bencher) {
49+
let mut m: LinkedList<_> = LinkedList::new();
50+
b.iter(|| {
51+
m.push_front(0);
52+
m.pop_front();
53+
})
54+
}
55+
56+
#[bench]
57+
fn bench_iter(b: &mut Bencher) {
58+
let v = &[0; 128];
59+
let m: LinkedList<_> = v.iter().cloned().collect();
60+
b.iter(|| {
61+
assert!(m.iter().count() == 128);
62+
})
63+
}
64+
#[bench]
65+
fn bench_iter_mut(b: &mut Bencher) {
66+
let v = &[0; 128];
67+
let mut m: LinkedList<_> = v.iter().cloned().collect();
68+
b.iter(|| {
69+
assert!(m.iter_mut().count() == 128);
70+
})
71+
}
72+
#[bench]
73+
fn bench_iter_rev(b: &mut Bencher) {
74+
let v = &[0; 128];
75+
let m: LinkedList<_> = v.iter().cloned().collect();
76+
b.iter(|| {
77+
assert!(m.iter().rev().count() == 128);
78+
})
79+
}
80+
#[bench]
81+
fn bench_iter_mut_rev(b: &mut Bencher) {
82+
let v = &[0; 128];
83+
let mut m: LinkedList<_> = v.iter().cloned().collect();
84+
b.iter(|| {
85+
assert!(m.iter_mut().rev().count() == 128);
86+
})
87+
}

0 commit comments

Comments
 (0)