optimistic-cell
A highly cache-efficient lock-like container for working with concurrent data where reads may take place optimistically and without modifying any cachelines.
Due to the fact that reads may access data that races with writes and is
only validated later, only items that are marked as Copy
may be read optimistically.
The write guard is essentially just a plain spinlock.
let n: u32 = 128 * 1024 * 1024;
let concurrency = 4;
let cell = & new;
let barrier = & new;
let before = now;
scope;
dbg!;
Workload scalability is highly dependent on the frequency of writes, and the duration that a writer may hold the cell locked for before dropping it.