| 1 | use craterust-analyzer cargo ringbuf 0.3.3 crate/::HeapRbrust-analyzer cargo ringbuf 0.3.3 alias/HeapRb#; |
| 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/slice/RB_SIZE.: usize = 1024; |
| 6 | |
| 7 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 8 | fn slice_x10rust-analyzer cargo ringbuf 0.3.3 benchmarks/slice/slice_x10().(b: &mut Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 9 | let buf = HeapRbrust-analyzer cargo ringbuf 0.3.3 alias/HeapRb#::<u64>::newrust-analyzer cargo ringbuf 0.3.3 ring_buffer/init/impl#[`SharedRb<T, Vec<MaybeUninit<T>>>`]new().(RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/slice/RB_SIZE.); |
| 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/slice/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 | let mut data = [1; 10]; |
| 13 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 14 | prod.push_slicerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push_slice().(&data); |
| 15 | cons.pop_slicerust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]pop_slice().(&mut data); |
| 16 | black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(data); |
| 17 | }); |
| 18 | } |
| 19 | |
| 20 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 21 | fn slice_x100rust-analyzer cargo ringbuf 0.3.3 benchmarks/slice/slice_x100().(b: &mut Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 22 | let buf = HeapRbrust-analyzer cargo ringbuf 0.3.3 alias/HeapRb#::<u64>::newrust-analyzer cargo ringbuf 0.3.3 ring_buffer/init/impl#[`SharedRb<T, Vec<MaybeUninit<T>>>`]new().(RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/slice/RB_SIZE.); |
| 23 | let (mut prod, mut cons) = buf.splitrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/impl#[`SharedRb<T, C>`]split().(); |
| 24 | 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/slice/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]); |
| 25 | let mut data = [1; 100]; |
| 26 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 27 | prod.push_slicerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push_slice().(&data); |
| 28 | cons.pop_slicerust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]pop_slice().(&mut data); |
| 29 | black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(data); |
| 30 | }); |
| 31 | } |
| 32 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 33 | fn slice_x1000rust-analyzer cargo ringbuf 0.3.3 benchmarks/slice/slice_x1000().(b: &mut Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 34 | let buf = HeapRbrust-analyzer cargo ringbuf 0.3.3 alias/HeapRb#::<u64>::newrust-analyzer cargo ringbuf 0.3.3 ring_buffer/init/impl#[`SharedRb<T, Vec<MaybeUninit<T>>>`]new().(RB_SIZErust-analyzer cargo ringbuf 0.3.3 benchmarks/slice/RB_SIZE.); |
| 35 | let (mut prod, mut cons) = buf.splitrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/impl#[`SharedRb<T, C>`]split().(); |
| 36 | prod.push_slicerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push_slice().(&[1; 12]); |
| 37 | let mut data = [1; 1000]; |
| 38 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 39 | prod.push_slicerust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push_slice().(&data); |
| 40 | cons.pop_slicerust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]pop_slice().(&mut data); |
| 41 | }); |
| 42 | black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(data); |
| 43 | } |