GithubHelp home page GithubHelp logo

rayon-hash's Introduction

Rayon Hash

rayon-hash crate rayon-hash documentation Travis Status deprecated

This crate is now deprecated, because the new implementation in std also exists as the hashbrown crate with its own "rayon" feature.

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:

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.31.0 or greater.

Known limitations

Some compromises may be made to let this work on stable Rust, compared to the standard types that may use unstable features. There is an example included which demonstrates one difference.

  • examples/may_dangle.rs: Since we don't use the unstable #[may_dangle] attributes, the type parameters of HashMap<K, V> and HashSet<T> must strictly outlive the container itself.

Unstable features

Some of the features copied from std would be guarded with #[unstable] attributes, but this isn't available to general crates. Instead, we guard these features with a config flag rayon_hash_unstable. The easiest way to use this is to set the RUSTFLAGS environment variable:

RUSTFLAGS='--cfg rayon_hash_unstable' cargo build

Note that this must not only be done for your crate, but for any crate that depends on your crate. This infectious nature is intentional, as it serves as a reminder that you are outside of the normal semver guarantees. These features may also require a nightly Rust compiler.

When such features are stabilized in the standard library, we will remove the rayon_hash_unstable guard here too.

License

Rayon-hash is distributed under the terms of both the MIT license and the Apache License (Version 2.0). See LICENSE-APACHE and LICENSE-MIT for details. Opening a pull requests is assumed to signal agreement with these licensing terms.

rayon-hash's People

Contributors

alexcrichton avatar apasel422 avatar arthurprs avatar aturon avatar binero avatar bluss avatar bors avatar bors[bot] avatar brson avatar centril avatar csouth3 avatar cuviper avatar eddyb avatar fintelia avatar frehberg avatar frewsxcv avatar gankra avatar glandium avatar guillaumegomez avatar kennytm avatar killercup avatar manishearth avatar nikomatsakis avatar pczarn avatar petrochenkov avatar sfackler avatar simonsapin avatar ssomers avatar steveklabnik avatar technicalguy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.