Crates.io | rw_lease |
lib.rs | rw_lease |
version | 0.1.0 |
source | src |
created_at | 2020-07-24 17:36:20.146674 |
updated_at | 2020-07-24 17:36:20.146674 |
description | Fast Reader-Writer lock with reader draining support. Based on a single (parameterisable) atomic usize. |
homepage | https://github.com/irrustible/rw_lease |
repository | https://github.com/irrustible/rw_lease |
max_upload_size | |
id | 269083 |
size | 40,191 |
Fast Reader-Writer lock with reader draining support. Based on a single (parameterisable) atomic usize.
Notes:
There are benchmarks, which you can and should run. Here are some numbers from my 2015 macbook pro on an AtomicUsize (the default):
Benchmark | Mutex | RwLock | RWLease |
---|---|---|---|
Create | 110 | 107 | 1 |
Uncontended Reads | 330731 (1.4) | 417664 (1.77) | 235656 (1) |
Contended Reads | 1140321 (1) | 2367186 (2.08) | 1488557 (1.31) |
Notes: measurements in nanoseconds, parens = normalised to shortest run.
We haven't spent terribly long optimising the code, there may be some wins left to gain.
Copyright (c) 2020 James Laver, rw_lease contributors.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.