| 1 | use craterust-analyzer cargo ringbuf 0.3.3 crate/::SharedRbrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/SharedRb#; |
| 2 | |
| 3 | use testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::{black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box()., Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#}; |
| 4 | |
| 5 | const RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE.: usize = 256; |
| 6 | |
| 7 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 8 | fn make_postponedrust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/make_postponed().(b: &mut Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 9 | let buf = SharedRbrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/SharedRb#::<u64, [_; RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE.]>::defaultrust-analyzer cargo ringbuf 0.3.3 ring_buffer/init/impl#[`SharedRb<T, [MaybeUninit<T>; N]>`][Default]default().(); |
| 10 | let (mut prod, mut cons) = buf.splitrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/impl#[`SharedRb<T, C>`]split().(); |
| 11 | prod.push_slicerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push_slice().(&[1; RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().2]); |
| 12 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 13 | black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(prod.postponedrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]postponed().()); |
| 14 | black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(cons.postponedrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]postponed().()); |
| 15 | }); |
| 16 | } |
| 17 | |
| 18 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 19 | fn advancerust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/advance().(b: &mut Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 20 | let buf = SharedRbrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/SharedRb#::<u64, [_; RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE.]>::defaultrust-analyzer cargo ringbuf 0.3.3 ring_buffer/init/impl#[`SharedRb<T, [MaybeUninit<T>; N]>`][Default]default().(); |
| 21 | let (mut prod, mut cons) = buf.splitrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/impl#[`SharedRb<T, C>`]split().(); |
| 22 | prod.push_slicerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push_slice().(&[1; RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().2]); |
| 23 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 24 | unsafe { prod.advancerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]advance().(1) }; |
| 25 | unsafe { cons.advancerust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]advance().(1) }; |
| 26 | }); |
| 27 | } |
| 28 | |
| 29 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 30 | fn advance_postponedrust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/advance_postponed().(b: &mut Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 31 | let buf = SharedRbrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/SharedRb#::<u64, [_; RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE.]>::defaultrust-analyzer cargo ringbuf 0.3.3 ring_buffer/init/impl#[`SharedRb<T, [MaybeUninit<T>; N]>`][Default]default().(); |
| 32 | let (mut prod, mut cons) = buf.splitrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/impl#[`SharedRb<T, C>`]split().(); |
| 33 | prod.push_slicerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push_slice().(&[1; RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().2]); |
| 34 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 35 | unsafe { prod.postponedrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]postponed().().advancerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]advance().(1) }; |
| 36 | unsafe { cons.postponedrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]postponed().().advancerust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]advance().(1) }; |
| 37 | }); |
| 38 | } |
| 39 | |
| 40 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 41 | fn get_occupied_slicesrust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/get_occupied_slices().(b: &mut Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 42 | let buf = SharedRbrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/SharedRb#::<u64, [_; RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE.]>::defaultrust-analyzer cargo ringbuf 0.3.3 ring_buffer/init/impl#[`SharedRb<T, [MaybeUninit<T>; N]>`][Default]default().(); |
| 43 | let (mut prod, mut cons) = buf.splitrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/impl#[`SharedRb<T, C>`]split().(); |
| 44 | prod.push_slicerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push_slice().(&[0; 3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().4]); |
| 45 | cons.skiprust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]skip().(RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE.); |
| 46 | prod.push_slicerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push_slice().(&[1; RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().2]); |
| 47 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 48 | black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(unsafe { cons.as_mut_uninit_slicesrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]as_mut_uninit_slices().() }); |
| 49 | black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(&mut cons); |
| 50 | }); |
| 51 | } |
| 52 | |
| 53 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 54 | fn get_vacant_slicesrust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/get_vacant_slices().(b: &mut Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 55 | let buf = SharedRbrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/SharedRb#::<u64, [_; RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE.]>::defaultrust-analyzer cargo ringbuf 0.3.3 ring_buffer/init/impl#[`SharedRb<T, [MaybeUninit<T>; N]>`][Default]default().(); |
| 56 | let (mut prod, mut cons) = buf.splitrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/impl#[`SharedRb<T, C>`]split().(); |
| 57 | prod.push_slicerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push_slice().(&[0; 1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().4]); |
| 58 | cons.skiprust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]skip().(RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE.); |
| 59 | prod.push_slicerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push_slice().(&[1; RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/parts/RB_SIZE. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().2]); |
| 60 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 61 | black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(unsafe { prod.free_space_as_slicesrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]free_space_as_slices().() }); |
| 62 | black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(&mut prod); |
| 63 | }); |
| 64 | } |