From d0e791558278ba9c67e6d5a2fa210d4d10d045cf Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 24 Apr 2019 17:23:47 -0700 Subject: [PATCH] Release 0.5.0, deprecated --- .travis.yml | 2 +- Cargo.toml | 11 +++++++++-- README.md | 26 +++++++++++++++++++------- benches/set_sum.rs | 12 ++++++++---- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4d74980..625ee3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ sudo: false matrix: fast_finish: true include: - - rust: 1.28.0 + - rust: 1.31.0 - rust: stable - rust: beta - rust: nightly diff --git a/Cargo.toml b/Cargo.toml index a932f3d..321fa4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [package] authors = ["Josh Stone "] name = "rayon-hash" -version = "0.4.1" +version = "0.5.0" repository = "https://github.com/rayon-rs/rayon-hash" documentation = "https://docs.rs/rayon-hash/" keywords = ["parallel", "iterator", "hash", "map", "set"] categories = ["concurrency", "data-structures"] -description = "HashMap and HashSet with support for Rayon parallel iterators" +description = "(deprecated) HashMap and HashSet with support for Rayon parallel iterators" license = "Apache-2.0/MIT" readme = "README.md" edition = "2018" @@ -17,3 +17,10 @@ rayon = "1.0" [dev-dependencies] rand = "0.6" rand_xorshift = "0.1" + +[dev-dependencies.hashbrown] +version = "0.3.0" +features = ["rayon"] + +[badges] +maintenance = { status = "deprecated" } diff --git a/README.md b/README.md index 366e9df..0ffc4e6 100644 --- a/README.md +++ b/README.md @@ -3,23 +3,35 @@ [![rayon-hash crate](https://img.shields.io/crates/v/rayon-hash.svg)](https://crates.io/crates/rayon-hash) [![rayon-hash documentation](https://docs.rs/rayon-hash/badge.svg)](https://docs.rs/rayon-hash) [![Travis Status](https://travis-ci.org/rayon-rs/rayon-hash.svg?branch=master)](https://travis-ci.org/rayon-rs/rayon-hash) +![deprecated](https://img.shields.io/badge/maintenance-deprecated-red.svg) -The `rayon-hash` crate duplicates the standard `HashMap` and `HashSet`, adding -native support for Rayon parallel iterators. +This crate is now **deprecated**, because the [new implementation in `std`] +also exists as the [`hashbrown`] crate with its own "rayon" feature. + +[new implementation in `std`]: https://github.com/rust-lang/rust/pull/58623 +[`hashbrown`]: https://crates.io/crates/hashbrown + +The `rayon-hash` crate duplicates the _former_ standard `HashMap` and +`HashSet`, adding native support for Rayon parallel iterators. Rayon does provide iterators for these standard types already, but since it can't access internal fields, it has to collect to an intermediate vector to be split into parallel jobs. With the custom types in `rayon-hash`, we can instead read the raw hash table directly, for much better performance. +Benchmarks using `rustc 1.36.0-nightly (e938c2b9a 2019-04-23)`, before the +`hashbrown` implementation had merged into `std`: + ```text -test rayon_set_sum_parallel ... bench: 1,035,111 ns/iter (+/- 57,327) -test rayon_set_sum_serial ... bench: 7,500,179 ns/iter (+/- 96,918) -test std_set_sum_parallel ... bench: 6,799,231 ns/iter (+/- 94,154) -test std_set_sum_serial ... bench: 7,634,174 ns/iter (+/- 84,806) +test hashbrown_set_sum_parallel ... bench: 617,405 ns/iter (+/- 58,565) +test hashbrown_set_sum_serial ... bench: 2,655,882 ns/iter (+/- 15,104) +test rayon_hash_set_sum_parallel ... bench: 1,368,058 ns/iter (+/- 75,984) +test rayon_hash_set_sum_serial ... bench: 7,558,175 ns/iter (+/- 190,545) +test std_hash_set_sum_parallel ... bench: 6,869,490 ns/iter (+/- 47,897) +test std_hash_set_sum_serial ... bench: 7,591,704 ns/iter (+/- 154,438) ``` -This crate currently requires `rustc 1.28.0` or greater. +This crate currently requires `rustc 1.31.0` or greater. ## Known limitations diff --git a/benches/set_sum.rs b/benches/set_sum.rs index 1fb47a5..0187438 100644 --- a/benches/set_sum.rs +++ b/benches/set_sum.rs @@ -6,12 +6,14 @@ extern crate rayon; extern crate rayon_hash; extern crate test; +use hashbrown::HashSet as HashBrownSet; use rand::distributions::Standard; use rand::{Rng, SeedableRng}; use rand_xorshift::XorShiftRng; use rayon::prelude::*; use rayon_hash::HashSet as RayonHashSet; use std::collections::HashSet as StdHashSet; +use std::collections::hash_map::RandomState; use std::iter::FromIterator; use test::Bencher; @@ -39,7 +41,9 @@ macro_rules! bench_set_sum { }; } -bench_set_sum!{std_set_sum_serial, StdHashSet<_>, iter} -bench_set_sum!{std_set_sum_parallel, StdHashSet<_>, par_iter} -bench_set_sum!{rayon_set_sum_serial, RayonHashSet<_>, iter} -bench_set_sum!{rayon_set_sum_parallel, RayonHashSet<_>, par_iter} +bench_set_sum!{std_hash_set_sum_serial, StdHashSet<_, RandomState>, iter} +bench_set_sum!{std_hash_set_sum_parallel, StdHashSet<_, RandomState>, par_iter} +bench_set_sum!{rayon_hash_set_sum_serial, RayonHashSet<_, RandomState>, iter} +bench_set_sum!{rayon_hash_set_sum_parallel, RayonHashSet<_, RandomState>, par_iter} +bench_set_sum!{hashbrown_set_sum_serial, HashBrownSet<_, RandomState>, iter} +bench_set_sum!{hashbrown_set_sum_parallel, HashBrownSet<_, RandomState>, par_iter}