Skip to content

Commit

Permalink
0.4.0 (#16)
Browse files Browse the repository at this point in the history
* add run_deferred calls after all test cases

additionally, run_deferred now allocates a pretty massive amount of
memory in the hopes of filling up the thread and global caches. it seems
to work pretty reliably, but it would be better if crossbeam-epoch
exposed an API for directly clearing out the thread and global caches.

* update copyright year in LICENSE to 2020

* add StripedHashMap (#14)

* move all HashMap code of note into BucketArrayRef

BucketArrayRef abstracts away the necessary parts of a hash map behind
references. This will make implementing the striped table extremely
easy!

* add striped::map::HashMap, alias as StripedHashMap

StripedHashMap partitions a hash map into submaps, where each submap is
allocated separately. This is an effort to further spread entries around
in memory and reduce contention.

* impl Drop for striped::map::HashMap

whoops!

* add #[inline] to all important table operations

all of these just dispatch out to another member function or to a
BucketArrayRef function. kind of wasteful to not inline them!

* reorder arguments to StripedHashMap constructors

to match the names of the functions

* correct feature names

* memset+Vec::set_len to write a lot of Shared::null

this provides a measurable boost to the performance of functions like
with_capacity. yes, unsafe, but also yes, really fast.

* double default minimum stripe amount

empirically provides the best performance

* reorganize tests into an icky macro invocation

* bump version to 0.4.0

* refer to segments as segments, not stripes

in the context of a hash table, striping refers to using a (relatively)
small set of locks per bucket. segmenting, the correct term, refers to
composing a large hash map out of several smaller hash maps (segments).
  • Loading branch information
Gregory-Meyer authored Mar 10, 2020
1 parent 5db7382 commit cf85f62
Show file tree
Hide file tree
Showing 11 changed files with 2,577 additions and 1,174 deletions.
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
[package]
name = "cht"
version = "0.3.0"
version = "0.4.0"
authors = ["Gregory Meyer <[email protected]>"]
edition = "2018"
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"]

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

[dev-dependencies]
criterion = "^0.3.1"
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Gregory Meyer
Copyright (c) 2020 Gregory Meyer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@
//! [Junction]: https://github.com/preshing/junction
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;
Loading

0 comments on commit cf85f62

Please sign in to comment.