Skip to content

Commit 5107676

Browse files
bors[bot]cuviper
andcommitted
583: Release rayon 1.0.2 and rayon-core 1.4.1 r=nikomatsakis a=cuviper This updates the test and demo dependencies, then it's about time for new rayon and rayon-core releases! Co-authored-by: Josh Stone <[email protected]>
2 parents b35e9d7 + c90e1ba commit 5107676

File tree

23 files changed

+178
-103
lines changed

23 files changed

+178
-103
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "rayon"
33
# Reminder to update html_rool_url in lib.rs when updating version
4-
version = "1.0.1"
4+
version = "1.0.2"
55
authors = ["Niko Matsakis <[email protected]>",
66
"Josh Stone <[email protected]>"]
77
description = "Simple work-stealing parallelism for Rust"
@@ -29,6 +29,6 @@ default-features = false
2929
[dev-dependencies]
3030
docopt = "1"
3131
lazy_static = "1"
32-
rand = "0.4"
32+
rand = "0.5"
3333
serde = "1"
3434
serde_derive = "1"

RELEASES.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
# Release rayon 1.0.2 / rayon-core 1.4.1
2+
3+
- The `ParallelBridge` trait with method `par_bridge()` makes it possible to
4+
use any `Send`able `Iterator` in parallel!
5+
- This trait has been added to `rayon::prelude`.
6+
- It automatically implements internal synchronization and queueing to
7+
spread the `Item`s across the thread pool. Iteration order is not
8+
preserved by this adaptor.
9+
- "Native" Rayon iterators like `par_iter()` should still be preferred when
10+
possible for better efficiency.
11+
- `ParallelString` now has additional methods for parity with `std` string
12+
iterators: `par_char_indices()`, `par_bytes()`, `par_encode_utf16()`,
13+
`par_matches()`, and `par_match_indices()`.
14+
- `ParallelIterator` now has fallible methods `try_fold()`, `try_reduce()`,
15+
and `try_for_each`, plus `*_with()` variants of each, for automatically
16+
short-circuiting iterators on `None` or `Err` values. These are inspired by
17+
`Iterator::try_fold()` and `try_for_each()` that were stabilized in Rust 1.27.
18+
- `Range<i128>` and `Range<u128>` are now supported with Rust 1.26 and later.
19+
- Small improvements have been made to the documentation.
20+
- `rayon-core` now only depends on `rand` for testing.
21+
- Rayon tests now work on stable Rust.
22+
23+
## Contributors
24+
25+
Thanks to all of the contributors for this release!
26+
27+
- @AndyGauge
28+
- @cuviper
29+
- @ignatenkobrain
30+
- @LukasKalbertodt
31+
- @MajorBreakfast
32+
- @nikomatsakis
33+
- @paulkernfeld
34+
- @QuietMisdreavus
35+
36+
137
# Release rayon 1.0.1
238

339
- Added more documentation for `rayon::iter::split()`.

rayon-core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rayon-core"
3-
version = "1.4.0" # reminder to update html_root_url attribute
3+
version = "1.4.1" # reminder to update html_root_url attribute
44
authors = ["Niko Matsakis <[email protected]>",
55
"Josh Stone <[email protected]>"]
66
description = "Core APIs for Rayon"
@@ -24,7 +24,7 @@ lazy_static = "1"
2424
version = "0.2.0"
2525

2626
[dev-dependencies]
27-
rand = "0.4"
27+
rand = "0.5"
2828

2929
[[test]]
3030
name = "stack_overflow_crash"

rayon-core/src/join/test.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use ThreadPoolBuilder;
44
use join::*;
55
use rand::{Rng, SeedableRng, XorShiftRng};
6+
use rand::distributions::Standard;
67
use unwind;
78

89
fn quick_sort<T: PartialOrd + Send>(v: &mut [T]) {
@@ -28,10 +29,16 @@ fn partition<T: PartialOrd + Send>(v: &mut [T]) -> usize {
2829
i
2930
}
3031

32+
fn seeded_rng() -> XorShiftRng {
33+
let mut seed = <XorShiftRng as SeedableRng>::Seed::default();
34+
(0..).zip(seed.as_mut()).for_each(|(i, x)| *x = i);
35+
XorShiftRng::from_seed(seed)
36+
}
37+
3138
#[test]
3239
fn sort() {
33-
let mut rng = XorShiftRng::from_seed([0, 1, 2, 3]);
34-
let mut data: Vec<_> = (0..6 * 1024).map(|_| rng.next_u32()).collect();
40+
let mut rng = seeded_rng();
41+
let mut data: Vec<u32> = rng.sample_iter(&Standard).take(6 * 1024).collect();
3542
let mut sorted_data = data.clone();
3643
sorted_data.sort();
3744
quick_sort(&mut data);
@@ -40,8 +47,8 @@ fn sort() {
4047

4148
#[test]
4249
fn sort_in_pool() {
43-
let mut rng = XorShiftRng::from_seed([0, 1, 2, 3]);
44-
let mut data: Vec<_> = (0..12 * 1024).map(|_| rng.next_u32()).collect();
50+
let mut rng = seeded_rng();
51+
let mut data: Vec<u32> = rng.sample_iter(&Standard).take(12 * 1024).collect();
4552

4653
let pool = ThreadPoolBuilder::new().build().unwrap();
4754
let mut sorted_data = data.clone();

rayon-core/src/scope/test.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,23 @@ impl<T: Send> Tree<T> {
105105

106106
fn random_tree(depth: usize) -> Tree<u32> {
107107
assert!(depth > 0);
108-
let mut rng = XorShiftRng::from_seed([0, 1, 2, 3]);
108+
let mut seed = <XorShiftRng as SeedableRng>::Seed::default();
109+
(0..).zip(seed.as_mut()).for_each(|(i, x)| *x = i);
110+
let mut rng = XorShiftRng::from_seed(seed);
109111
random_tree1(depth, &mut rng)
110112
}
111113

112114
fn random_tree1(depth: usize, rng: &mut XorShiftRng) -> Tree<u32> {
113115
let children = if depth == 0 {
114116
vec![]
115117
} else {
116-
(0..(rng.next_u32() % 3)) // somewhere between 0 and 3 children at each level
118+
(0..rng.gen_range(0, 4)) // somewhere between 0 and 3 children at each level
117119
.map(|_| random_tree1(depth - 1, rng))
118120
.collect()
119121
};
120122

121123
Tree {
122-
value: rng.next_u32() % 1_000_000,
124+
value: rng.gen_range(0, 1_000_000),
123125
children: children,
124126
}
125127
}

rayon-demo/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ publish = false
77
[dependencies]
88
rayon = { path = "../" }
99
cgmath = "0.16"
10-
docopt = "0.8"
10+
docopt = "1"
1111
fixedbitset = "0.1.5"
12-
glium = "0.20"
12+
glium = "0.21"
1313
lazy_static = "1"
1414
odds = "0.3"
15-
rand = "0.4"
16-
regex = "0.2"
15+
rand = "0.5"
16+
regex = "1"
1717
serde = "1"
1818
serde_derive = "1"
1919
time = "0.1"
2020

2121
[dev-dependencies]
22-
num = "0.1.30"
22+
num = "0.2"

rayon-demo/src/find/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ macro_rules! make_tests {
55
mod $m {
66
use rayon::prelude::*;
77
use test::Bencher;
8-
use rand::{Rng, SeedableRng, XorShiftRng};
8+
use rand::Rng;
9+
use rand::distributions::Standard;
910

1011
lazy_static! {
1112
static ref HAYSTACK: Vec<[u32; $n]> = {
12-
let mut rng = XorShiftRng::from_seed([0, 1, 2, 3]);
13-
(0..10_000_000).map(|_| {
13+
let mut rng = ::seeded_rng();
14+
rng.sample_iter(&Standard).map(|x| {
1415
let mut result: [u32; $n] = [0; $n];
15-
result[0] = rng.next_u32();
16+
result[0] = x;
1617
result
17-
}).collect()
18+
}).take(10_000_000).collect()
1819
};
1920
}
2021

rayon-demo/src/life/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Options:
1313

1414

1515
use rand::{thread_rng, Rng};
16+
use rand::distributions::Standard;
1617
use std::iter::repeat;
1718
use std::num::Wrapping;
1819
use std::sync::Arc;
@@ -74,7 +75,7 @@ impl Board {
7475
}
7576

7677
pub fn random(&self) -> Board {
77-
let new_brd = thread_rng().gen_iter().take(self.len()).collect();
78+
let new_brd = thread_rng().sample_iter(&Standard).take(self.len()).collect();
7879

7980
self.next_board(new_brd)
8081
}

rayon-demo/src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,10 @@ fn main() {
9595
_ => usage()
9696
}
9797
}
98+
99+
fn seeded_rng() -> rand::XorShiftRng {
100+
use rand::{SeedableRng, XorShiftRng};
101+
let mut seed = <XorShiftRng as SeedableRng>::Seed::default();
102+
(0..).zip(seed.as_mut()).for_each(|(i, x)| *x = i);
103+
XorShiftRng::from_seed(seed)
104+
}

rayon-demo/src/mergesort/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use rand::{Rng, SeedableRng, XorShiftRng};
1+
use rand::Rng;
2+
use rand::distributions::Standard;
23

34
const USAGE: &'static str = "
45
Usage: mergesort bench [--size N]
@@ -220,8 +221,8 @@ pub fn is_sorted<T: Send + Ord>(v: &mut [T]) -> bool {
220221
}
221222

222223
fn default_vec(n: usize) -> Vec<u32> {
223-
let mut rng = XorShiftRng::from_seed([0, 1, 2, 3]);
224-
(0..n).map(|_| rng.next_u32()).collect()
224+
let mut rng = ::seeded_rng();
225+
rng.sample_iter(&Standard).take(n).collect()
225226
}
226227

227228
fn timed_sort<F: FnOnce(&mut [u32])>(n: usize, f: F, name: &str) -> u64 {

0 commit comments

Comments
 (0)