-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I've added some unit tests recently, but they were not run as part of our GitHub actions. This commit Also fix some broken unit tests. The unit tests were correct but sometimes they would race with each other and fail. I added the `serial_test` crate so we can annotate the tests with `#[serial]` to ensure they don't run together (as these tests modify a global variable). Also fixed some unused var warning that seems to have only started showing up in recent versions of rust/clippy.
- Loading branch information
Showing
132 changed files
with
19,033 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,5 @@ jobs: | |
run: cargo check | ||
- name: Clippy | ||
run: cargo clippy | ||
- name: Test | ||
run: cargo test |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"files":{"Cargo.toml":"c758b23fe682b4e447bc5350e1e838577ed6ec4ec8833607ff16f57f1d0495a7","LICENSE":"16692e8cee4aa06e3913787497eba2d47c42002014136f5da67be6ee640e28a3","README.md":"7f7b4edce5b4baabf639df517a66bfa2cd8ff759f09060c17fe6da54531b5819","rust-toolchain.toml":"8e14ad3424881d09f3b219e947b4b95f12726295abde287f91d10af8c5a7dd13","src/arbitrary.rs":"236abf377cbae8393961e0e4327ce2515d5aeeddfb1fabb1f2035c69dfea290c","src/iter.rs":"086a7be951241253b3ea60c64fb324aaa32742038461994e3946bdd8712ce452","src/iter_set.rs":"5327da951dc93d30b293aeb7a805666ee4b8e6364881348ab5d86b23c29a0e13","src/lib.rs":"6ec142f4ad577da1e399738a4bbcdee0baae5290d5b5274e6d295d92bcf113ba","src/lock.rs":"22b1013ee3cbd1598c26403552faf8e5b44fe98a8ff4c8812da15d57bdeee4b3","src/mapref/entry.rs":"c03777d2b863a98fea517ad97037741930c766e7cbd17aea2aab1fbf0e11c719","src/mapref/mod.rs":"15bd45cfc642a9e3e77bbfbf2d9fad9c5fac0ff6904214a3c501e262242ec8b0","src/mapref/multiple.rs":"17a87879229d78f75d71817d100aa0a210d764d6b66e4a05b17a3e092d17e306","src/mapref/one.rs":"0026aff85dd5411b5c181396b8b5b9a9cbc524720a8f409fd4aa62c1b5501146","src/rayon/map.rs":"68d541bb6c9372fe13e44f09d9fcba4f214f52f16649e326486f8976dc03cd99","src/rayon/read_only.rs":"99dc0083f6840f59b2090bc9c5f9767a44088832e63935cb8f6bc7eca8b86102","src/rayon/set.rs":"21fe2ca8c58c8ff1bc753f5e2eb6131afd598211eea375f2ac7190cd0f9abcba","src/read_only.rs":"012a6e44195125eb3c0fd028123b348f5294c7e083bf1c3c0bf8400201c35e27","src/serde.rs":"9854d44b05ebe400ef8ac8ea9c8f140e1c59870d74aaf3ccaf72e82c6dc40905","src/set.rs":"cf75d91db42d18afec314afe9a461cc6e86ddedd11ff9248ed7345780948e5e0","src/setref/mod.rs":"cc39e406a333dc6c04398f4b1336fb400e3a8360c387466d8a91f5d7f4ed40a7","src/setref/multiple.rs":"2270749e83f80dbb4761448f0629ecd02b0b4268f76834236d1167844e6d5e37","src/setref/one.rs":"69738583f2a160f3907e540277ccd88e0036406b3ead66b3d4015ddd938d6937","src/t.rs":"9b40ebfba22369813bf159ed60fa70e742ae72bfaec6aee91a716cba91cb8f0d","src/try_result.rs":"81d1dd396f70b0aa2a6e1969851b706cbfdfb09c802ac9d33dcace882aa28dd1","src/util.rs":"7a8096a713cf04e60d6c9e38cd366314ed74472abab4bb8a3a9ed081a0e0301b"},"package":"978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
# | ||
# When uploading crates to the registry Cargo will automatically | ||
# "normalize" Cargo.toml files for maximal compatibility | ||
# with all versions of Cargo and also rewrite `path` dependencies | ||
# to registry (e.g., crates.io) dependencies. | ||
# | ||
# If you are reading this file be aware that the original Cargo.toml | ||
# will likely look very different (and much more reasonable). | ||
# See Cargo.toml.orig for the original contents. | ||
|
||
[package] | ||
edition = "2018" | ||
rust-version = "1.65" | ||
name = "dashmap" | ||
version = "5.5.3" | ||
authors = ["Acrimon <joel.wejdenstal@gmail.com>"] | ||
description = "Blazing fast concurrent HashMap for Rust." | ||
homepage = "https://github.com/xacrimon/dashmap" | ||
documentation = "https://docs.rs/dashmap" | ||
readme = "README.md" | ||
keywords = [ | ||
"atomic", | ||
"concurrent", | ||
"hashmap", | ||
] | ||
categories = [ | ||
"concurrency", | ||
"algorithms", | ||
"data-structures", | ||
] | ||
license = "MIT" | ||
repository = "https://github.com/xacrimon/dashmap" | ||
|
||
[package.metadata.docs.rs] | ||
features = [ | ||
"rayon", | ||
"raw-api", | ||
"serde", | ||
] | ||
|
||
[dependencies.arbitrary] | ||
version = "1.3.0" | ||
optional = true | ||
|
||
[dependencies.cfg-if] | ||
version = "1.0.0" | ||
|
||
[dependencies.hashbrown] | ||
version = "0.14.0" | ||
default-features = false | ||
|
||
[dependencies.lock_api] | ||
version = "0.4.10" | ||
|
||
[dependencies.once_cell] | ||
version = "1.18.0" | ||
|
||
[dependencies.parking_lot_core] | ||
version = "0.9.8" | ||
|
||
[dependencies.rayon] | ||
version = "1.7.0" | ||
optional = true | ||
|
||
[dependencies.serde] | ||
version = "1.0.188" | ||
features = ["derive"] | ||
optional = true | ||
|
||
[features] | ||
inline = ["hashbrown/inline-more"] | ||
raw-api = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Acrimon | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# DashMap | ||
|
||
Blazingly fast concurrent map in Rust. | ||
|
||
DashMap is an implementation of a concurrent associative array/hashmap in Rust. | ||
|
||
DashMap tries to implement an easy to use API similar to `std::collections::HashMap` | ||
with some slight changes to handle concurrency. | ||
|
||
DashMap tries to be very simple to use and to be a direct replacement for `RwLock<HashMap<K, V>>`. | ||
To accomplish these goals, all methods take `&self` instead of modifying methods taking `&mut self`. | ||
This allows you to put a DashMap in an `Arc<T>` and share it between threads while still being able to modify it. | ||
|
||
DashMap puts great effort into performance and aims to be as fast as possible. | ||
If you have any suggestions or tips do not hesitate to open an issue or a PR. | ||
|
||
[](https://crates.io/crates/dashmap) | ||
|
||
[](https://docs.rs/dashmap) | ||
|
||
[](https://crates.io/crates/dashmap) | ||
|
||
[](https://crates.io/crates/dashmap) | ||
|
||
## Cargo features | ||
|
||
- `serde` - Enables serde support. | ||
|
||
- `raw-api` - Enables the unstable raw-shard api. | ||
|
||
- `rayon` - Enables rayon support. | ||
|
||
- `inline` - Enables `inline-more` feature from the `hashbrown` crate. Can lead to better performance, but with the cost of longer compile-time. | ||
|
||
- `arbitrary` - Enables support for the `arbitrary` crate. | ||
|
||
## Contributing | ||
|
||
DashMap gladly accepts contributions! | ||
Do not hesitate to open issues or PR's. | ||
|
||
I will take a look as soon as I have time for it. | ||
|
||
That said I do not get paid (yet) to work on open-source. This means | ||
that my time is limited and my work here comes after my personal life. | ||
|
||
## Performance | ||
|
||
A comprehensive benchmark suite including DashMap can be found [here](https://github.com/xacrimon/conc-map-bench). | ||
|
||
## Special thanks | ||
|
||
- [Jon Gjengset](https://github.com/jonhoo) | ||
|
||
- [Yato](https://github.com/RustyYato) | ||
|
||
- [Karl Bergström](https://github.com/kabergstrom) | ||
|
||
- [Dylan DPC](https://github.com/Dylan-DPC) | ||
|
||
- [Lokathor](https://github.com/Lokathor) | ||
|
||
- [namibj](https://github.com/namibj) | ||
|
||
## License | ||
|
||
This project is licensed under MIT. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[toolchain] | ||
channel = "1.65" | ||
components = ["rustfmt", "clippy"] | ||
profile = "minimal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use arbitrary::{Arbitrary, Unstructured}; | ||
use core::hash::BuildHasher; | ||
|
||
impl<'a, K, V, S> Arbitrary<'a> for crate::DashMap<K, V, S> | ||
where | ||
K: Eq + std::hash::Hash + Arbitrary<'a>, | ||
V: Arbitrary<'a>, | ||
S: Default + BuildHasher + Clone, | ||
{ | ||
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> { | ||
u.arbitrary_iter()?.collect() | ||
} | ||
} |
Oops, something went wrong.