Skip to content

Commit a4fb614

Browse files
committed
Auto merge of #39613 - frewsxcv:rollup, r=frewsxcv
Rollup of 15 pull requests - Successful merges: #38764, #39361, #39426, #39462, #39482, #39557, #39561, #39582, #39583, #39587, #39598, #39599, #39601, #39602, #39604 - Failed merges:
2 parents c49d102 + 9d5dbeb commit a4fb614

Some content is hidden

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

78 files changed

+1946
-1561
lines changed

mk/cfg/i686-unknown-netbsd.mk

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# rustbuild-only target

src/bootstrap/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ struct Build {
148148
python: Option<String>,
149149
full_bootstrap: Option<bool>,
150150
extended: Option<bool>,
151+
verbose: Option<usize>,
151152
}
152153

153154
/// TOML representation of various global install decisions.
@@ -292,6 +293,7 @@ impl Config {
292293
set(&mut config.vendor, build.vendor);
293294
set(&mut config.full_bootstrap, build.full_bootstrap);
294295
set(&mut config.extended, build.extended);
296+
set(&mut config.verbose, build.verbose);
295297

296298
if let Some(ref install) = toml.install {
297299
config.prefix = install.prefix.clone().map(PathBuf::from);

src/bootstrap/config.toml.example

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@
124124
# disabled by default.
125125
#extended = false
126126

127+
# Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose
128+
#verbose = 0
129+
127130
# =============================================================================
128131
# General install configuration options
129132
# =============================================================================

src/bootstrap/dist.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
517517

518518
let branch = match &build.config.channel[..] {
519519
"stable" |
520-
"beta" => {
521-
build.release.split(".").take(2).collect::<Vec<_>>().join(".")
522-
}
520+
"beta" => format!("rust-{}", build.release_num),
523521
_ => "master".to_string(),
524522
};
525523

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 renamed to 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)