Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip slots with active reading Refs #80

Closed
wants to merge 5 commits into from

Conversation

tukan
Copy link
Contributor

@tukan tukan commented Apr 28, 2023

Core::push_ref can go into an (almost infinite) spin loop waiting for a Ref (created in pop_ref) to this slot to be dropped. This behaviour can lead to writing being blocked unless all refs are dropped, even if we have free space in the buffer.

In this PR I propose a mechanism to skip such slots (by updating their state) and attempt to write into them on the next lap.

…_ref`)

to this slot to be dropped.

Add ability to `Core::push_ref` to skip such slots and attempt to reuse them
on the next lap.
@tukan tukan marked this pull request as ready for review April 28, 2023 15:27
Copy link
Owner

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, I'm definitely in favor of making this change if it avoids a potentially long-running spin loop!

I had some suggestions about the implementation; in particular, I think we might be better off storing the presence of the reader as a bit in the slot's state field, so the entire state can be read from and written to in a single atomic operation, rather than requiring two reads to synchronize.

I'd really like to see some loom tests exercising the new behavior, if possible. Also, if you don't mind running the crate's benchmarks before and after making this change, I'd love to see if it results in a substantial performance improvement.

Thanks again!

src/lib.rs Outdated
Comment on lines 185 to 186
where
R: Recycle<T>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny nit: is this how rustfmt wanted us to format this? let's make sure it's rustfmt-approved before merging, please :)

@@ -101,6 +103,7 @@ struct Core {
struct Slot<T> {
value: UnsafeCell<MaybeUninit<T>>,
state: AtomicUsize,
has_reader: AtomicBool,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really necessary to add an entire additional AtomicBool (a whole word) to store what is essentially one bit of information? would it make sense to store this in the state by setting one bit in the state field instead? we could use the first bit to indicate if there is a reader, and store the generation of the slot in the remaining 63 bits, accessing the generation by shifting the value by 1.

this would have a couple advantages: one, it would decrease the size of each slot by a word --- the memory usage isn't a huge deal, but it does scale with the size of the buffer, which could be meaningful.

more importantly, though, the current approach stores two separate pieces of shared state in the Slot type, which are not both accessed atomically. this means there is a potential for racy behavior to occur when one value has been updated and the other has not yet been. if we store the presence of a reader as a single bit in the state field, both values are always read and written in a single atomic operation.

on the other hand, the approach i'm describing introduces some extra complexity to the code, since the presence of the reader field is not obvious on the struct definition and is instead hidden behind a bitfield...if there isn't a potential for racy behavior here, it may be better to keep this in a separate field.

Comment on lines +215 to +227
let state = test_dbg!(slot.state.load(SeqCst));
// slot is writable
if test_dbg!(state == tail) {
// Move the tail index forward by 1.
let next_tail = self.next(idx, gen);
// try to advance the tail
match test_dbg!(self
.tail
.compare_exchange_weak(tail, next_tail, SeqCst, Acquire))
{
Ok(_) => {
// We got the slot! It's now okay to write to it
test_println!("claimed tail slot [{}]", idx);
// Claim exclusive ownership over the slot
let ptr = slot.value.get_mut();

// Initialize or recycle the element.
unsafe {
// Safety: we have just claimed exclusive ownership over
// this slot.
let ptr = ptr.deref();
if gen == 0 {
ptr.write(recycle.new_element());
test_println!("-> initialized");
} else {
// Safety: if the generation is > 0, then the
// slot has already been initialized.
recycle.recycle(ptr.assume_init_mut());
test_println!("-> recycled");
test_println!("advanced tail {} to {}", tail, next_tail);
test_println!("claimed slot [{}]", idx);
let has_reader = test_dbg!(slot.has_reader.load(SeqCst));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like it was necessary to change these loads from Acquire to SeqCst because we need the loads of the state and has_reader fields to have a happens-before relationship? if we apply my above suggestion about merging the has-reader bit into the state variable, we could avoid the need to synchronize between two loads, and we could still perform Acquire loads here. this might improve performance a bit...

Comment on lines +75 to +124
#[test]
fn spsc_skip_slot() {
let (tx, rx) = blocking::channel::<usize>(3);
// 0 lap
tx.send(0).unwrap();
assert_eq!(rx.recv(), Some(0));
tx.send(1).unwrap();
let msg_ref = rx.try_recv_ref().unwrap();
tx.send(2).unwrap();
assert_eq!(rx.recv(), Some(2));
// 1 lap
tx.send(3).unwrap();
assert_eq!(rx.recv(), Some(3));
tx.send(4).unwrap();
assert_eq!(rx.recv(), Some(4));
drop(msg_ref);
// 2 lap
tx.send(5).unwrap();
tx.send(6).unwrap();
tx.send(7).unwrap();
assert!(matches!(tx.try_send_ref(), Err(TrySendError::Full(_))));
assert_eq!(rx.recv(), Some(5));
assert_eq!(rx.recv(), Some(6));
assert_eq!(rx.recv(), Some(7));
}

#[test]
fn spsc_full_after_skipped() {
let (tx, rx) = blocking::channel::<usize>(3);
// 0 lap
tx.send(0).unwrap();
assert_eq!(rx.recv(), Some(0));
tx.send(1).unwrap();
let _msg_ref = rx.try_recv_ref().unwrap();
tx.send(2).unwrap();
// lap 1
tx.send(3).unwrap();
assert!(matches!(tx.try_send_ref(), Err(TrySendError::Full(_))));
}

#[test]
fn spsc_empty_after_skipped() {
let (tx, rx) = blocking::channel::<usize>(2);
// 0 lap
tx.send(0).unwrap();
tx.send(1).unwrap();
let _msg_ref = rx.try_recv_ref().unwrap();
assert_eq!(rx.recv(), Some(1));
assert!(matches!(rx.try_recv_ref(), Err(TryRecvError::Empty)));
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add tests for this behavior that will run under loom, as well, or do the existing loom tests sufficiently exercise it?

src/lib.rs Outdated Show resolved Hide resolved
Comment on lines +512 to +521
if self.is_pop {
test_println!("drop Ref<{}> (pop)", core::any::type_name::<T>());
test_dbg!(self.slot.has_reader.store(test_dbg!(false), SeqCst));
} else {
test_println!(
"drop Ref<{}> (push), new_state = {}",
core::any::type_name::<T>(),
self.new_state
);
test_dbg!(self.slot.state.store(test_dbg!(self.new_state), Release));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we took my suggestion of storing the reader bit in the state field, the Drop impl could be simplified, and Ref could be one word smaller, because we would either store a new_state that advances the generation, or one that clears the reader bit.

@hawkw
Copy link
Owner

hawkw commented Apr 28, 2023

huh, interesting --- running the benchmarks on my machine, there's a substantial performance improvement for the blocking SPSC tests, but the equivalent benchmarks for the async channel have a slightly less substantial but still quite significant performance regression.

benchmark results
Switched to branch 'feature/skip-slots'
warning: Patch `loom v0.5.4 (https://github.com/tokio-rs/loom?rev=a93bf2390e0fcfdb7c5899b31db0e4e795ab4aab#a93bf239)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
   Compiling thingbuf v0.1.4 (/home/eliza/Code/thingbuf)
   Compiling bench v0.1.0 (/home/eliza/Code/thingbuf/bench)
    Finished bench [optimized] target(s) in 2.25s
     Running unittests src/lib.rs (target/release/deps/bench-651e78781cb0daa5)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running benches/async_mpsc.rs (target/release/deps/async_mpsc-29f8fd78cf6b30a4)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

Gnuplot not found, using plotters backend
async/mpsc_reusable/ThingBuf/10
                        time:   [51.461 us 52.067 us 52.629 us]
                        change: [-6.6955% -5.7616% -4.7633%] (p = 0.00 < 0.05)
                        Performance has improved.
async/mpsc_reusable/ThingBuf/50
                        time:   [142.01 us 143.82 us 145.49 us]
                        change: [+1.2092% +2.6059% +4.1304%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) low mild
async/mpsc_reusable/ThingBuf/100
                        time:   [285.68 us 289.44 us 292.91 us]
                        change: [+18.051% +20.108% +22.291%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 8 outliers among 100 measurements (8.00%)
  1 (1.00%) low severe
  2 (2.00%) low mild
  5 (5.00%) high mild

async/mpsc_integer/ThingBuf/10
                        time:   [240.84 us 246.87 us 252.66 us]
                        change: [-0.6169% +2.0080% +4.5013%] (p = 0.14 > 0.05)
                        No change in performance detected.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) low mild
async/mpsc_integer/ThingBuf/50
                        time:   [388.42 us 391.37 us 394.25 us]
                        change: [-12.444% -10.787% -9.2507%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  1 (1.00%) low severe
  4 (4.00%) low mild
  1 (1.00%) high mild
  2 (2.00%) high severe
async/mpsc_integer/ThingBuf/100
                        time:   [525.14 us 533.13 us 540.88 us]
                        change: [-9.1218% -7.4284% -5.5914%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  3 (3.00%) low mild
  2 (2.00%) high mild
  4 (4.00%) high severe

     Running benches/async_mpsc_nowait.rs (target/release/deps/async_mpsc_nowait-5b68acbdaec95806)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

Gnuplot not found, using plotters backend
async/nowait/mpsc_reusable/ThingBuf/10
                        time:   [47.747 us 48.196 us 48.645 us]
                        change: [-8.8845% -7.6099% -6.0530%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) low mild
  1 (1.00%) high severe
async/nowait/mpsc_reusable/ThingBuf/50
                        time:   [125.29 us 126.48 us 127.69 us]
                        change: [+6.4731% +8.1073% +9.7789%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) low mild
  1 (1.00%) high mild
async/nowait/mpsc_reusable/ThingBuf/100
                        time:   [345.51 us 348.93 us 352.30 us]
                        change: [+7.1795% +8.5257% +9.8829%] (p = 0.00 < 0.05)
                        Performance has regressed.

async/nowait/mpsc_integer/ThingBuf/10
                        time:   [48.039 us 48.696 us 49.351 us]
                        change: [+7.2696% +8.9940% +10.790%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) low mild
async/nowait/mpsc_integer/ThingBuf/50
                        time:   [123.93 us 125.28 us 126.61 us]
                        change: [-9.6968% -8.4147% -7.0411%] (p = 0.00 < 0.05)
                        Performance has improved.
async/nowait/mpsc_integer/ThingBuf/100
                        time:   [339.38 us 342.92 us 346.32 us]
                        change: [-9.2659% -8.0762% -6.8344%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) low severe
  1 (1.00%) low mild

     Running benches/async_mpsc_utils.rs (target/release/deps/async_mpsc_utils-ed77afcfd3b6a99a)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running benches/async_spsc.rs (target/release/deps/async_spsc-64731b2d02b2e4d4)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

Gnuplot not found, using plotters backend
async/spsc/try_send_reusable/ThingBuf/100
                        time:   [12.232 us 12.256 us 12.279 us]
                        thrpt:  [8.1437 Melem/s 8.1595 Melem/s 8.1752 Melem/s]
                 change:
                        time:   [+7.6314% +7.9451% +8.2447%] (p = 0.00 < 0.05)
                        thrpt:  [-7.6167% -7.3603% -7.0903%]
                        Performance has regressed.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
async/spsc/try_send_reusable/ThingBuf/500
                        time:   [50.091 us 50.241 us 50.398 us]
                        thrpt:  [9.9209 Melem/s 9.9520 Melem/s 9.9819 Melem/s]
                 change:
                        time:   [+13.674% +14.098% +14.499%] (p = 0.00 < 0.05)
                        thrpt:  [-12.663% -12.356% -12.029%]
                        Performance has regressed.
Found 7 outliers among 100 measurements (7.00%)
  5 (5.00%) high mild
  2 (2.00%) high severe
async/spsc/try_send_reusable/ThingBuf/1000
                        time:   [96.971 us 97.358 us 97.768 us]
                        thrpt:  [10.228 Melem/s 10.271 Melem/s 10.312 Melem/s]
                 change:
                        time:   [+13.814% +14.205% +14.625%] (p = 0.00 < 0.05)
                        thrpt:  [-12.759% -12.438% -12.137%]
                        Performance has regressed.
Found 9 outliers among 100 measurements (9.00%)
  6 (6.00%) high mild
  3 (3.00%) high severe
async/spsc/try_send_reusable/ThingBuf/5000
                        time:   [475.89 us 477.31 us 478.75 us]
                        thrpt:  [10.444 Melem/s 10.475 Melem/s 10.507 Melem/s]
                 change:
                        time:   [+11.764% +12.102% +12.475%] (p = 0.00 < 0.05)
                        thrpt:  [-11.091% -10.795% -10.526%]
                        Performance has regressed.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
async/spsc/try_send_reusable/ThingBuf/10000
                        time:   [943.08 us 945.14 us 947.18 us]
                        thrpt:  [10.558 Melem/s 10.580 Melem/s 10.604 Melem/s]
                 change:
                        time:   [+9.6643% +9.9255% +10.177%] (p = 0.00 < 0.05)
                        thrpt:  [-9.2369% -9.0293% -8.8126%]
                        Performance has regressed.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

async/spsc/try_send_integer/ThingBuf/100
                        time:   [7.8945 us 7.9061 us 7.9176 us]
                        thrpt:  [12.630 Melem/s 12.648 Melem/s 12.667 Melem/s]
                 change:
                        time:   [+6.3259% +6.6025% +6.8710%] (p = 0.00 < 0.05)
                        thrpt:  [-6.4293% -6.1935% -5.9495%]
                        Performance has regressed.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
async/spsc/try_send_integer/ThingBuf/500
                        time:   [38.738 us 38.847 us 38.960 us]
                        thrpt:  [12.834 Melem/s 12.871 Melem/s 12.907 Melem/s]
                 change:
                        time:   [+8.5924% +9.0331% +9.4821%] (p = 0.00 < 0.05)
                        thrpt:  [-8.6609% -8.2847% -7.9125%]
                        Performance has regressed.
Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) high mild
  4 (4.00%) high severe
async/spsc/try_send_integer/ThingBuf/1000
                        time:   [76.982 us 77.198 us 77.431 us]
                        thrpt:  [12.915 Melem/s 12.954 Melem/s 12.990 Melem/s]
                 change:
                        time:   [+9.4332% +9.7999% +10.170%] (p = 0.00 < 0.05)
                        thrpt:  [-9.2315% -8.9252% -8.6201%]
                        Performance has regressed.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
async/spsc/try_send_integer/ThingBuf/5000
                        time:   [385.39 us 386.81 us 388.43 us]
                        thrpt:  [12.872 Melem/s 12.926 Melem/s 12.974 Melem/s]
                 change:
                        time:   [+10.401% +10.800% +11.246%] (p = 0.00 < 0.05)
                        thrpt:  [-10.109% -9.7471% -9.4209%]
                        Performance has regressed.
async/spsc/try_send_integer/ThingBuf/10000
                        time:   [761.02 us 762.85 us 764.79 us]
                        thrpt:  [13.075 Melem/s 13.109 Melem/s 13.140 Melem/s]
                 change:
                        time:   [+7.3156% +7.6792% +8.0578%] (p = 0.00 < 0.05)
                        thrpt:  [-7.4570% -7.1315% -6.8169%]
                        Performance has regressed.
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe

async/spsc/reusable/ThingBuf/100
                        time:   [11.563 us 11.617 us 11.663 us]
                        thrpt:  [8.5741 Melem/s 8.6081 Melem/s 8.6481 Melem/s]
                 change:
                        time:   [+21.574% +22.050% +22.538%] (p = 0.00 < 0.05)
                        thrpt:  [-18.392% -18.067% -17.746%]
                        Performance has regressed.
async/spsc/reusable/ThingBuf/500
                        time:   [41.485 us 41.562 us 41.655 us]
                        thrpt:  [12.003 Melem/s 12.030 Melem/s 12.052 Melem/s]
                 change:
                        time:   [+24.652% +24.906% +25.188%] (p = 0.00 < 0.05)
                        thrpt:  [-20.120% -19.940% -19.777%]
                        Performance has regressed.
Found 5 outliers among 100 measurements (5.00%)
  5 (5.00%) high mild
async/spsc/reusable/ThingBuf/1000
                        time:   [79.607 us 79.731 us 79.888 us]
                        thrpt:  [12.517 Melem/s 12.542 Melem/s 12.562 Melem/s]
                 change:
                        time:   [+28.093% +28.299% +28.560%] (p = 0.00 < 0.05)
                        thrpt:  [-22.215% -22.057% -21.932%]
                        Performance has regressed.
Found 8 outliers among 100 measurements (8.00%)
  8 (8.00%) high mild
async/spsc/reusable/ThingBuf/5000
                        time:   [379.43 us 380.57 us 381.90 us]
                        thrpt:  [13.092 Melem/s 13.138 Melem/s 13.178 Melem/s]
                 change:
                        time:   [+29.220% +29.565% +29.876%] (p = 0.00 < 0.05)
                        thrpt:  [-23.003% -22.819% -22.612%]
                        Performance has regressed.
Found 4 outliers among 100 measurements (4.00%)
  4 (4.00%) high mild
async/spsc/reusable/ThingBuf/10000
                        time:   [760.23 us 761.60 us 763.15 us]
                        thrpt:  [13.104 Melem/s 13.130 Melem/s 13.154 Melem/s]
                 change:
                        time:   [+30.677% +30.906% +31.175%] (p = 0.00 < 0.05)
                        thrpt:  [-23.766% -23.609% -23.476%]
                        Performance has regressed.
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe

     Running benches/sync_spsc.rs (target/release/deps/sync_spsc-49d5041324d02706)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

Gnuplot not found, using plotters backend
sync/spsc/try_send_reusable/ThingBuf/100
                        time:   [42.394 us 42.562 us 42.732 us]
                        thrpt:  [2.3402 Melem/s 2.3495 Melem/s 2.3588 Melem/s]
                 change:
                        time:   [-15.536% -15.074% -14.633%] (p = 0.00 < 0.05)
                        thrpt:  [+17.142% +17.750% +18.394%]
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  1 (1.00%) low mild
  4 (4.00%) high mild
sync/spsc/try_send_reusable/ThingBuf/500
                        time:   [139.98 us 141.32 us 142.64 us]
                        thrpt:  [3.5053 Melem/s 3.5381 Melem/s 3.5719 Melem/s]
                 change:
                        time:   [-16.680% -15.741% -14.706%] (p = 0.00 < 0.05)
                        thrpt:  [+17.242% +18.682% +20.019%]
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  1 (1.00%) low severe
  2 (2.00%) low mild
  1 (1.00%) high mild
sync/spsc/try_send_reusable/ThingBuf/1000
                        time:   [239.03 us 241.64 us 244.35 us]
                        thrpt:  [4.0925 Melem/s 4.1384 Melem/s 4.1837 Melem/s]
                 change:
                        time:   [-21.922% -20.888% -19.831%] (p = 0.00 < 0.05)
                        thrpt:  [+24.737% +26.403% +28.076%]
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  1 (1.00%) low severe
  7 (7.00%) low mild
sync/spsc/try_send_reusable/ThingBuf/5000
                        time:   [598.88 us 611.74 us 624.65 us]
                        thrpt:  [8.0045 Melem/s 8.1734 Melem/s 8.3490 Melem/s]
                 change:
                        time:   [-55.093% -53.257% -50.608%] (p = 0.00 < 0.05)
                        thrpt:  [+102.46% +113.94% +122.68%]
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild
  1 (1.00%) high severe
Benchmarking sync/spsc/try_send_reusable/ThingBuf/10000: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.2s, enable flat sampling, or reduce sample count to 60.
sync/spsc/try_send_reusable/ThingBuf/10000
                        time:   [1.0498 ms 1.0641 ms 1.0777 ms]
                        thrpt:  [9.2786 Melem/s 9.3972 Melem/s 9.5258 Melem/s]
                 change:
                        time:   [-64.556% -63.972% -63.443%] (p = 0.00 < 0.05)
                        thrpt:  [+173.54% +177.56% +182.13%]
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) low mild

sync/spsc/blocking_send_reusable/ThingBuf/100
                        time:   [40.749 us 40.847 us 40.949 us]
                        thrpt:  [2.4421 Melem/s 2.4481 Melem/s 2.4540 Melem/s]
                 change:
                        time:   [-13.507% -13.146% -12.739%] (p = 0.00 < 0.05)
                        thrpt:  [+14.599% +15.136% +15.617%]
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) low mild
  1 (1.00%) high mild
  1 (1.00%) high severe
sync/spsc/blocking_send_reusable/ThingBuf/500
                        time:   [132.96 us 133.59 us 134.22 us]
                        thrpt:  [3.7253 Melem/s 3.7428 Melem/s 3.7605 Melem/s]
                 change:
                        time:   [-21.308% -20.800% -20.294%] (p = 0.00 < 0.05)
                        thrpt:  [+25.461% +26.263% +27.078%]
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) low mild
  1 (1.00%) high mild
sync/spsc/blocking_send_reusable/ThingBuf/1000
                        time:   [181.68 us 183.58 us 185.53 us]
                        thrpt:  [5.3899 Melem/s 5.4474 Melem/s 5.5041 Melem/s]
                 change:
                        time:   [-50.304% -49.769% -49.152%] (p = 0.00 < 0.05)
                        thrpt:  [+96.663% +99.079% +101.22%]
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) low mild
  1 (1.00%) high mild
sync/spsc/blocking_send_reusable/ThingBuf/5000
                        time:   [775.78 us 786.97 us 798.03 us]
                        thrpt:  [6.2655 Melem/s 6.3535 Melem/s 6.4451 Melem/s]
                 change:
                        time:   [-56.013% -55.207% -54.355%] (p = 0.00 < 0.05)
                        thrpt:  [+119.08% +123.25% +127.34%]
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  2 (2.00%) low mild
  3 (3.00%) high mild
Benchmarking sync/spsc/blocking_send_reusable/ThingBuf/10000: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.4s, enable flat sampling, or reduce sample count to 60.
sync/spsc/blocking_send_reusable/ThingBuf/10000
                        time:   [1.0882 ms 1.1027 ms 1.1172 ms]
                        thrpt:  [8.9510 Melem/s 9.0684 Melem/s 9.1894 Melem/s]
                 change:
                        time:   [-68.958% -68.406% -67.770%] (p = 0.00 < 0.05)
                        thrpt:  [+210.27% +216.52% +222.14%]
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  2 (2.00%) low mild
  2 (2.00%) high mild
  1 (1.00%) high severe

i wonder why that is!

@tukan
Copy link
Contributor Author

tukan commented Apr 28, 2023

Thank you for your comments and suggestions, I will go through them probably this Sunday and ask for another round of review.

@hawkw
Copy link
Owner

hawkw commented Apr 28, 2023

Great, sounds good to me!

@hawkw hawkw mentioned this pull request May 15, 2023
@fslongjin
Copy link

hi, here's an issue: #83

@hawkw hawkw closed this in a72a286 Apr 6, 2024
hawkw added a commit that referenced this pull request Apr 6, 2024
## v0.1.5 (2024-04-06)

#### Features

* **mpsc:**  add `len`, `capacity`, and `remaining` methods to mpsc (#72) ([00213c1](00213c1), closes [#71](#71))

#### Bug Fixes

*   unused import with `alloc` enabled ([ac1eafc](ac1eafc))
*   skip slots with active reading `Ref`s in `push_ref` (#81) ([a72a286](a72a286), closes [#83](#83), [#80](#80))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants