about summary refs log tree commit diff
path: root/src/liballoc/benches
diff options
context:
space:
mode:
authorStein Somers <git@steinsomers.be>2019-01-09 15:15:18 +0100
committerStein Somers <git@steinsomers.be>2019-01-09 15:15:18 +0100
commitccba43df81d5bda37c9e4d231ad4443e6f3a7e44 (patch)
treeefe674e2d5ae721f38fa8558385e0a2f12997227 /src/liballoc/benches
parentf9f71cc32497ee4e3cbc7d9795bcf358a9268c13 (diff)
parent664c7797f6bfddf9f5e67474c2fd8017f91d7110 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/liballoc/benches')
-rw-r--r--src/liballoc/benches/btree/map.rs15
-rw-r--r--src/liballoc/benches/btree/mod.rs10
-rw-r--r--src/liballoc/benches/lib.rs11
-rw-r--r--src/liballoc/benches/linked_list.rs10
-rw-r--r--src/liballoc/benches/slice.rs13
-rw-r--r--src/liballoc/benches/str.rs18
-rw-r--r--src/liballoc/benches/string.rs10
-rw-r--r--src/liballoc/benches/vec.rs10
-rw-r--r--src/liballoc/benches/vec_deque.rs10
-rw-r--r--src/liballoc/benches/vec_deque_append.rs12
10 files changed, 10 insertions, 109 deletions
diff --git a/src/liballoc/benches/btree/map.rs b/src/liballoc/benches/btree/map.rs
index 20b9091a07b..a6f584534d1 100644
--- a/src/liballoc/benches/btree/map.rs
+++ b/src/liballoc/benches/btree/map.rs
@@ -1,18 +1,7 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
 use std::iter::Iterator;
 use std::vec::Vec;
 use std::collections::BTreeMap;
-use rand::{Rng, thread_rng};
+use rand::{Rng, seq::SliceRandom, thread_rng};
 use test::{Bencher, black_box};
 
 macro_rules! map_insert_rand_bench {
@@ -78,7 +67,7 @@ macro_rules! map_find_rand_bench {
                 map.insert(k, k);
             }
 
-            rng.shuffle(&mut keys);
+            keys.shuffle(&mut rng);
 
             // measure
             let mut i = 0;
diff --git a/src/liballoc/benches/btree/mod.rs b/src/liballoc/benches/btree/mod.rs
index f436b0ac0c0..4dc2dfd9153 100644
--- a/src/liballoc/benches/btree/mod.rs
+++ b/src/liballoc/benches/btree/mod.rs
@@ -1,11 +1 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 mod map;
diff --git a/src/liballoc/benches/lib.rs b/src/liballoc/benches/lib.rs
index b4f4fd74f3a..08c69ee6e85 100644
--- a/src/liballoc/benches/lib.rs
+++ b/src/liballoc/benches/lib.rs
@@ -1,18 +1,9 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 #![feature(repr_simd)]
 #![feature(slice_sort_by_cached_key)]
 #![feature(test)]
 
 extern crate rand;
+extern crate rand_xorshift;
 extern crate test;
 
 mod btree;
diff --git a/src/liballoc/benches/linked_list.rs b/src/liballoc/benches/linked_list.rs
index bbac44553f1..29c5ad2bc6e 100644
--- a/src/liballoc/benches/linked_list.rs
+++ b/src/liballoc/benches/linked_list.rs
@@ -1,13 +1,3 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 use std::collections::LinkedList;
 use test::Bencher;
 
diff --git a/src/liballoc/benches/slice.rs b/src/liballoc/benches/slice.rs
index 490320f57cb..b9ebd74f799 100644
--- a/src/liballoc/benches/slice.rs
+++ b/src/liballoc/benches/slice.rs
@@ -1,19 +1,10 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 use rand::{thread_rng};
 use std::mem;
 use std::ptr;
 
-use rand::{Rng, SeedableRng, XorShiftRng};
+use rand::{Rng, SeedableRng};
 use rand::distributions::{Standard, Alphanumeric};
+use rand_xorshift::XorShiftRng;
 use test::{Bencher, black_box};
 
 #[bench]
diff --git a/src/liballoc/benches/str.rs b/src/liballoc/benches/str.rs
index 38c94d4d8b5..7f8661bd968 100644
--- a/src/liballoc/benches/str.rs
+++ b/src/liballoc/benches/str.rs
@@ -1,13 +1,3 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 use test::{Bencher, black_box};
 
 #[bench]
@@ -274,11 +264,11 @@ make_test!(split_a_str, s, s.split("a").count());
 make_test!(trim_ascii_char, s, {
     s.trim_matches(|c: char| c.is_ascii())
 });
-make_test!(trim_left_ascii_char, s, {
-    s.trim_left_matches(|c: char| c.is_ascii())
+make_test!(trim_start_ascii_char, s, {
+    s.trim_start_matches(|c: char| c.is_ascii())
 });
-make_test!(trim_right_ascii_char, s, {
-    s.trim_right_matches(|c: char| c.is_ascii())
+make_test!(trim_end_ascii_char, s, {
+    s.trim_end_matches(|c: char| c.is_ascii())
 });
 
 make_test!(find_underscore_char, s, s.find('_'));
diff --git a/src/liballoc/benches/string.rs b/src/liballoc/benches/string.rs
index 36be21d978e..2933014cb58 100644
--- a/src/liballoc/benches/string.rs
+++ b/src/liballoc/benches/string.rs
@@ -1,13 +1,3 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 use std::iter::repeat;
 use test::Bencher;
 
diff --git a/src/liballoc/benches/vec.rs b/src/liballoc/benches/vec.rs
index 41490117068..590c49f4ef5 100644
--- a/src/liballoc/benches/vec.rs
+++ b/src/liballoc/benches/vec.rs
@@ -1,13 +1,3 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 use test::Bencher;
 use std::iter::{FromIterator, repeat};
 
diff --git a/src/liballoc/benches/vec_deque.rs b/src/liballoc/benches/vec_deque.rs
index 380645e7cd0..f7aadbdbd82 100644
--- a/src/liballoc/benches/vec_deque.rs
+++ b/src/liballoc/benches/vec_deque.rs
@@ -1,13 +1,3 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 use std::collections::VecDeque;
 use test::{Bencher, black_box};
 
diff --git a/src/liballoc/benches/vec_deque_append.rs b/src/liballoc/benches/vec_deque_append.rs
index bd335651137..2db8fbe1309 100644
--- a/src/liballoc/benches/vec_deque_append.rs
+++ b/src/liballoc/benches/vec_deque_append.rs
@@ -1,14 +1,4 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(duration_as_u128)]
+#![cfg_attr(stage0, feature(duration_as_u128))]
 use std::{collections::VecDeque, time::Instant};
 
 const VECDEQUE_LEN: i32 = 100000;