Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit 744d5c3

Browse files
bors[bot]fhartwigmeltinglavaCentrileuclio
committed
Merge #25
25: Release 0.5.0, deprecated r=cuviper a=cuviper This is the last subtree merge before `hashbrown` replaced the `std` types in rust-lang/rust#58623. I am also marking this crate deprecated -- folks who want to parallelize these types going forward should use `hashbrown`'s own "rayon" feature. Co-authored-by: Florian Hartwig <[email protected]> Co-authored-by: Meltinglava <[email protected]> Co-authored-by: Mazdak Farrokhzad <[email protected]> Co-authored-by: Andy Russell <[email protected]> Co-authored-by: bors <[email protected]> Co-authored-by: Guillaume Gomez <[email protected]> Co-authored-by: Steven Fackler <[email protected]> Co-authored-by: John Kåre Alsaker <[email protected]> Co-authored-by: Hidehito Yabuuchi <[email protected]> Co-authored-by: Corey Farwell <[email protected]> Co-authored-by: kennytm <[email protected]> Co-authored-by: Alexander Regueiro <[email protected]> Co-authored-by: Stein Somers <[email protected]> Co-authored-by: Ryan Marcus <[email protected]> Co-authored-by: Mark Rousskov <[email protected]> Co-authored-by: Wiktor Kuchta <[email protected]> Co-authored-by: Anthony Ramine <[email protected]> Co-authored-by: Scott McMurray <[email protected]>
2 parents 816f5bc + d0e7915 commit 744d5c3

File tree

13 files changed

+681
-619
lines changed

13 files changed

+681
-619
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sudo: false
44
matrix:
55
fast_finish: true
66
include:
7-
- rust: 1.28.0
7+
- rust: 1.31.0
88
- rust: stable
99
- rust: beta
1010
- rust: nightly

Cargo.toml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
[package]
22
authors = ["Josh Stone <[email protected]>"]
33
name = "rayon-hash"
4-
version = "0.4.1"
4+
version = "0.5.0"
55
repository = "https://github.com/rayon-rs/rayon-hash"
66
documentation = "https://docs.rs/rayon-hash/"
77
keywords = ["parallel", "iterator", "hash", "map", "set"]
88
categories = ["concurrency", "data-structures"]
9-
description = "HashMap and HashSet with support for Rayon parallel iterators"
9+
description = "(deprecated) HashMap and HashSet with support for Rayon parallel iterators"
1010
license = "Apache-2.0/MIT"
1111
readme = "README.md"
12+
edition = "2018"
1213

1314
[dependencies]
1415
rayon = "1.0"
1516

1617
[dev-dependencies]
1718
rand = "0.6"
1819
rand_xorshift = "0.1"
20+
21+
[dev-dependencies.hashbrown]
22+
version = "0.3.0"
23+
features = ["rayon"]
24+
25+
[badges]
26+
maintenance = { status = "deprecated" }

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,35 @@
33
[![rayon-hash crate](https://img.shields.io/crates/v/rayon-hash.svg)](https://crates.io/crates/rayon-hash)
44
[![rayon-hash documentation](https://docs.rs/rayon-hash/badge.svg)](https://docs.rs/rayon-hash)
55
[![Travis Status](https://travis-ci.org/rayon-rs/rayon-hash.svg?branch=master)](https://travis-ci.org/rayon-rs/rayon-hash)
6+
![deprecated](https://img.shields.io/badge/maintenance-deprecated-red.svg)
67

7-
The `rayon-hash` crate duplicates the standard `HashMap` and `HashSet`, adding
8-
native support for Rayon parallel iterators.
8+
This crate is now **deprecated**, because the [new implementation in `std`]
9+
also exists as the [`hashbrown`] crate with its own "rayon" feature.
10+
11+
[new implementation in `std`]: https://github.com/rust-lang/rust/pull/58623
12+
[`hashbrown`]: https://crates.io/crates/hashbrown
13+
14+
The `rayon-hash` crate duplicates the _former_ standard `HashMap` and
15+
`HashSet`, adding native support for Rayon parallel iterators.
916

1017
Rayon does provide iterators for these standard types already, but since it
1118
can't access internal fields, it has to collect to an intermediate vector to be
1219
split into parallel jobs. With the custom types in `rayon-hash`, we can
1320
instead read the raw hash table directly, for much better performance.
1421

22+
Benchmarks using `rustc 1.36.0-nightly (e938c2b9a 2019-04-23)`, before the
23+
`hashbrown` implementation had merged into `std`:
24+
1525
```text
16-
test rayon_set_sum_parallel ... bench: 1,035,111 ns/iter (+/- 57,327)
17-
test rayon_set_sum_serial ... bench: 7,500,179 ns/iter (+/- 96,918)
18-
test std_set_sum_parallel ... bench: 6,799,231 ns/iter (+/- 94,154)
19-
test std_set_sum_serial ... bench: 7,634,174 ns/iter (+/- 84,806)
26+
test hashbrown_set_sum_parallel ... bench: 617,405 ns/iter (+/- 58,565)
27+
test hashbrown_set_sum_serial ... bench: 2,655,882 ns/iter (+/- 15,104)
28+
test rayon_hash_set_sum_parallel ... bench: 1,368,058 ns/iter (+/- 75,984)
29+
test rayon_hash_set_sum_serial ... bench: 7,558,175 ns/iter (+/- 190,545)
30+
test std_hash_set_sum_parallel ... bench: 6,869,490 ns/iter (+/- 47,897)
31+
test std_hash_set_sum_serial ... bench: 7,591,704 ns/iter (+/- 154,438)
2032
```
2133

22-
This crate currently requires `rustc 1.28.0` or greater.
34+
This crate currently requires `rustc 1.31.0` or greater.
2335

2436
## Known limitations
2537

benches/set_sum.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ extern crate rayon;
66
extern crate rayon_hash;
77
extern crate test;
88

9+
use hashbrown::HashSet as HashBrownSet;
910
use rand::distributions::Standard;
1011
use rand::{Rng, SeedableRng};
1112
use rand_xorshift::XorShiftRng;
1213
use rayon::prelude::*;
1314
use rayon_hash::HashSet as RayonHashSet;
1415
use std::collections::HashSet as StdHashSet;
16+
use std::collections::hash_map::RandomState;
1517
use std::iter::FromIterator;
1618
use test::Bencher;
1719

@@ -39,7 +41,9 @@ macro_rules! bench_set_sum {
3941
};
4042
}
4143

42-
bench_set_sum!{std_set_sum_serial, StdHashSet<_>, iter}
43-
bench_set_sum!{std_set_sum_parallel, StdHashSet<_>, par_iter}
44-
bench_set_sum!{rayon_set_sum_serial, RayonHashSet<_>, iter}
45-
bench_set_sum!{rayon_set_sum_parallel, RayonHashSet<_>, par_iter}
44+
bench_set_sum!{std_hash_set_sum_serial, StdHashSet<_, RandomState>, iter}
45+
bench_set_sum!{std_hash_set_sum_parallel, StdHashSet<_, RandomState>, par_iter}
46+
bench_set_sum!{rayon_hash_set_sum_serial, RayonHashSet<_, RandomState>, iter}
47+
bench_set_sum!{rayon_hash_set_sum_parallel, RayonHashSet<_, RandomState>, par_iter}
48+
bench_set_sum!{hashbrown_set_sum_serial, HashBrownSet<_, RandomState>, iter}
49+
bench_set_sum!{hashbrown_set_sum_parallel, HashBrownSet<_, RandomState>, par_iter}

src/intrinsics.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#[inline(always)]
2+
pub unsafe fn unlikely(b: bool) -> bool {
3+
b
4+
}

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ extern crate rayon;
55
#[cfg(test)] extern crate rand;
66

77
mod alloc;
8+
#[cfg(rayon_hash_unstable)]
9+
mod intrinsics;
810
mod ptr;
911

1012
// #[stable(feature = "rust1", since = "1.0.0")]

src/par/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rayon::iter::{FromParallelIterator, IntoParallelIterator, ParallelExtend, Pa
33
use std::hash::{BuildHasher, Hash};
44

55
use super::table;
6-
use HashMap;
6+
use crate::HashMap;
77

88
pub use self::table::{ParIntoIter, ParIter, ParIterMut};
99
pub use self::table::{ParKeys, ParValues, ParValuesMut};

src/par/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rayon::iter::{FromParallelIterator, IntoParallelIterator, ParallelExtend, Pa
44
use std::hash::{BuildHasher, Hash};
55

66
use super::map;
7-
use HashSet;
7+
use crate::HashSet;
88

99
pub struct ParIntoIter<T: Send> {
1010
inner: map::ParIntoIter<T, ()>,

src/par/table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::ptr;
55
use rayon::iter::plumbing::*;
66
use rayon::prelude::*;
77

8-
use std_hash::table::{RawBucket, RawTable};
8+
use crate::std_hash::table::{RawBucket, RawTable};
99

1010
struct SplitBuckets<'a, K, V> {
1111
bucket: RawBucket<K, V>,

0 commit comments

Comments
 (0)