ptab 0.1.0

Lock-free concurrent table optimized for read-heavy workloads
Documentation
# ptab

Lock-free concurrent table optimized for read-heavy workloads.

Inspired by the Erlang/OTP BEAM process table, `ptab` provides a fixed-capacity table where lookup operations perform no shared memory writes - not even reference counts. This enables linear read scalability with CPU count.

## Usage

Add the following to your `Cargo.toml`:

```toml
[dependencies]
ptab = "0.1"
```

## Example

```rust
let table: ptab::PTab<&str> = ptab::PTab::new();
let index: ptab::Detached = table.insert("hello").unwrap();

assert_eq!(table.read(index), Some("hello"));
assert!(table.remove(index));
assert_eq!(table.read(index), None);
```

## Performance

Under contention (16 threads reading a single hot key):

|            | ptab    | sharded-slab |
|------------|--------:|-------------:|
| Throughput | 212 M/s |      155 K/s |

Use `ptab` when reads dominate. Use [`sharded-slab`] for write-heavy workloads or dynamic capacity.

## Design

See [`IMPLEMENTATION.md`] for details.

- **Zero-contention reads**: Lookups use only thread-local state and atomic loads
- **Cache-line aware**: Consecutive allocations distributed across cache lines
- **Generational indices**: Slot reuse produces different indices (ABA prevention)
- **Epoch-based reclamation**: Safe memory management via [`sdd`]

<br>

#### License

<sup>
  Licensed under either of <a href="LICENSE-APACHE">Apache License, Version 2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
</sup>

<br>

<sub>
  Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
</sub>

[//]: # (links)

[`IMPLEMENTATION.md`]: IMPLEMENTATION.md
[`sharded-slab`]: https://crates.io/crates/sharded-slab
[`sdd`]: https://crates.io/crates/sdd