Skip to content

Commit

Permalink
Merge pull request vorner#50 from vorner/no-half-lock
Browse files Browse the repository at this point in the history
Replace the half-lock with helping strategy
  • Loading branch information
vorner authored Jan 3, 2021
2 parents 10355d6 + de104f8 commit 64dcf40
Show file tree
Hide file tree
Showing 23 changed files with 1,328 additions and 1,837 deletions.
47 changes: 46 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,52 @@ jobs:
RUST_VERSION: ${{ matrix.rust }}
OS: ${{ matrix.os }}
RUSTFLAGS: -D warnings
run: cargo test --release --all-features
run: cargo test --all-features

big-tests:
name: Run the big ignored tests
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal

- name: Restore cache
uses: Swatinem/rust-cache@v1

- name: Build & test
env:
RUSTFLAGS: -D warnings
run: cargo test --all-features --release -- --ignored

bits32:
name: 32bit tests
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal
target: x86_64-unknown-linux-musl

- name: Restore cache
uses: Swatinem/rust-cache@v1

- name: Build & test
env:
RUSTFLAGS: -D warnings
run: cargo test --all-features --target x86_64-unknown-linux-musl

rustfmt:
name: Check formatting
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.2.0

* Miri and 32 bit tests in CI.
* Making the writers lock-free. Soft-removing the IndependentStrategy, as it is
no longer needed (hidden and the same as the DafultStrategy).

# 1.1.0

* Fix soundness bug around access::Map. Technically a breaking change, but
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "arc-swap"
version = "1.1.0"
version = "1.2.0"
authors = ["Michal 'vorner' Vaner <vorner@vorner.cz>"]
description = "Atomically swappable Arc"
documentation = "https://docs.rs/arc-swap"
Expand All @@ -17,12 +17,12 @@ appveyor = { repository = "vorner/arc-swap" }
maintenance = { status = "actively-developed" }

[features]
# Enable some more, experimental strategies.
# **These are not part of the stability guarantees** and may be changed, renamed
# or removed at any time.
experimental-strategies = []
# ArcSwapWeak (for std::sycn::Weak) support
weak = []
# Some strategies used for testing few internal cornercases. *DO NOT USE* (no stability guarantees and their performance is likely very bad).
internal-test-strategies = []
# Possibly some strategies we are experimenting with. Currently empty. No stability guarantees are included about them.
experimental-strategies = []

[dependencies]

Expand Down
22 changes: 3 additions & 19 deletions benches/background.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion};
use crossbeam_utils::thread;
use once_cell::sync::Lazy;

const ITERS: usize = 100;
// Mostly a leftover from earlier times, but it still allows one to tweak the number of ops per one
// iteration of the benchmark easily, so it's left in here.
const ITERS: usize = 1;

macro_rules! method {
($c: expr, $name:ident) => {{
Expand Down Expand Up @@ -119,11 +121,6 @@ macro_rules! strategy {
}

strategy!(arc_swap_b, ArcSwap::<usize>);
#[cfg(feature = "experimental-strategies")]
strategy!(
arc_swap_helping,
arc_swap::ArcSwapAny::<Arc<usize>, arc_swap::strategy::experimental::Helping>
);

mod arc_swap_option {
use super::{black_box, ArcSwapOption, Criterion, Lazy};
Expand Down Expand Up @@ -325,19 +322,6 @@ mod parking_rwlock {
}
}

#[cfg(feature = "experimental-strategies")]
criterion_group!(
benches,
arc_swap_b::run_all,
arc_swap_helping::run_all,
arc_swap_option::run_all,
arc_swap_cached::run_all,
mutex::run_all,
parking_mutex::run_all,
rwlock::run_all,
parking_rwlock::run_all,
);
#[cfg(not(feature = "experimental-strategies"))]
criterion_group!(
benches,
arc_swap_b::run_all,
Expand Down
Loading

0 comments on commit 64dcf40

Please sign in to comment.