Skip to content

Commit

Permalink
0.5.0 (#28)
Browse files Browse the repository at this point in the history
* convert license from MIT to AGPL-3.0-or-later (#21)

Now that I've started working, I've very quickly started to see and
recognize the value of having implementations of novel algorithms have
strong copyleft licenses. Let's quantify this with a couple numbers,
shall we?

Let's say my salary is $150k for an junior position at FAAAN. Let's then
say that I work 8 hours a day, five days a week, 52 weeks a year. That's
2,080 hours of work a year, at $72.12 an hour. cht is 2745 source lines
of code at the time of writing. If a professional developer can write 50
lines of code a day, it would take them 54.9 days to reproduce cht. 54.9
days is 439.2 hours of work time, which is $31,675.10 of junior
developer time.

In other words, if your company wants to save $31,675.10 dollars by
using my code instead of writing it yourself: please open source your
work.

* Remove unnecessary benchmarks and dependencies (#22)

* remove benchmarks

These naive benchmarks are kind of useless compared to a proper
benchmarking harness like [bustle]. I recommend you look into something
more comprehensive (like bustle!) if you are looking at benchmarks.

[bustle]: https://github.com/jonhoo/bustle

* remove dependency on aHash

I don't think there is a particularly good reason to use aHash by
default when the standard library provides a perfectly serviceable
hashing function on its own. If you are tuning for performance, I think
you would use something like [xxh3], [wyhash], or [aHash] anyways, and
you're probably going to explicitly specify it too so I don't swipe it
out from underneath you (like I'm doing right now!).

[xxh3]: https://github.com/Cyan4973/xxHash
[wyhash]: https://github.com/wangyi-fudan/wyhash
[aHash]: https://github.com/tkaitchuck/ahash

* bump num_cpus from 1.12.0 to 1.13.0

* Remove SegmentedHashMap (#25)

The segmented hash map doesn't **actually** benchmark faster... why
would anybody use it? Also, I would like to not have to maintain the
code. This is especially troublesome given that, after checking my
commit history, it appears that I maintain this repository about once
a year.

* update to Rust 2021, bump dependencies (#26)

* Update year of AGPL 3.0 license headers (#27)

* Bump version to 0.5.0
  • Loading branch information
Gregory-Meyer authored Dec 13, 2021
1 parent b7770a0 commit 89fa285
Show file tree
Hide file tree
Showing 13 changed files with 770 additions and 1,571 deletions.
29 changes: 4 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,12 @@
[package]
name = "cht"
version = "0.4.1"
version = "0.5.0"
authors = ["Gregory Meyer <[email protected]>"]
edition = "2018"
edition = "2021"
description = "Lockfree resizeable concurrent hash table."
repository = "https://github.com/Gregory-Meyer/cht"
readme = "README.md"
license = "MIT"

[features]
default = ["num-cpus"]
num-cpus = ["num_cpus"]
license = "AGPL-3.0-or-later"

[dependencies]
ahash = "^0.3.2"
crossbeam-epoch = "^0.8.2"
num_cpus = { version = "^1.12.0", optional = true }

[dev-dependencies]
criterion = "^0.3.1"
hashbrown = "^0.7.0"
lock_api = "^0.3.3"
num_cpus = "^1.12.0"
parking_lot = "^0.10.0"

[[bench]]
name = "cht"
harness = false

[[bench]]
name = "mutex"
harness = false
crossbeam-epoch = "0.9"
682 changes: 661 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ performance.
In your `Cargo.toml`:

```toml
cht = "^0.4.1"
cht = "0.5"
```

Then in your code:
Expand Down Expand Up @@ -46,4 +46,4 @@ let _: Vec<_> = threads.into_iter().map(|t| t.join()).collect();

## License

cht is licensed under the MIT license.
cht is licensed under the GNU Affero General Public License v3.0 or later.
91 changes: 0 additions & 91 deletions benches/cht.rs

This file was deleted.

144 changes: 0 additions & 144 deletions benches/mutex.rs

This file was deleted.

33 changes: 11 additions & 22 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
// MIT License
// Copyright (C) 2021 Gregory Meyer
//
// Copyright (c) 2020 Gregory Meyer
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// 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:
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//! Lockfree hash tables.
//!
Expand Down Expand Up @@ -96,11 +87,9 @@
//! [a tech talk]: https://youtu.be/HJ-719EGIts
pub mod map;
pub mod segment;

#[cfg(test)]
#[macro_use]
pub(crate) mod test_util;

pub use map::HashMap;
pub use segment::HashMap as SegmentedHashMap;
33 changes: 12 additions & 21 deletions src/map.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
// MIT License
// Copyright (C) 2021 Gregory Meyer
//
// Copyright (c) 2020 Gregory Meyer
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// 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:
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//! A lockfree hash map implemented with bucket pointer arrays, open addressing,
//! and linear probing.
Expand All @@ -33,11 +24,11 @@ use bucket_array_ref::BucketArrayRef;

use std::{
borrow::Borrow,
collections::hash_map::RandomState,
hash::{BuildHasher, Hash},
sync::atomic::{self, AtomicUsize, Ordering},
};

use ahash::RandomState;
use crossbeam_epoch::{self, Atomic};

/// Default hasher for `HashMap`.
Expand Down
Loading

0 comments on commit 89fa285

Please sign in to comment.