| 1 | #![feature(test)] |
| 2 | |
| 3 | extern crate testrust-analyzer cargo leb128 0.2.5 test/; |
| 4 | use leb128rust-analyzer cargo leb128 0.2.5 crate/; |
| 5 | |
| 6 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 7 | fn write_signedrust-analyzer cargo leb128 0.2.5 write_signed().(b: &mut testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 8 | let mut buf = [0; 4096]; |
| 9 | |
| 10 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 11 | let mut writable = &mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().; |
| 12 | for i in -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().1025..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1025 { |
| 13 | 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().(leb128rust-analyzer cargo leb128 0.2.5 crate/::writerust-analyzer cargo leb128 0.2.5 write/::signedrust-analyzer cargo leb128 0.2.5 write/signed().(&mut writable, i).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 14 | } |
| 15 | }); |
| 16 | } |
| 17 | |
| 18 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 19 | fn write_unsignedrust-analyzer cargo leb128 0.2.5 write_unsigned().(b: &mut testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 20 | let mut buf = [0; 4096]; |
| 21 | |
| 22 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 23 | let mut writable = &mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().; |
| 24 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#2050 { |
| 25 | 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().(leb128rust-analyzer cargo leb128 0.2.5 crate/::writerust-analyzer cargo leb128 0.2.5 write/::unsignedrust-analyzer cargo leb128 0.2.5 write/unsigned().(&mut writable, i).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 26 | } |
| 27 | }); |
| 28 | } |
| 29 | |
| 30 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 31 | fn read_signedrust-analyzer cargo leb128 0.2.5 read_signed().(b: &mut testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 32 | let mut buf = [0; 4096]; |
| 33 | |
| 34 | { |
| 35 | let mut writable = &mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().; |
| 36 | for i in -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().1025..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1025 { |
| 37 | leb128rust-analyzer cargo leb128 0.2.5 crate/::writerust-analyzer cargo leb128 0.2.5 write/::signedrust-analyzer cargo leb128 0.2.5 write/signed().(&mut writable, i).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 42 | let mut readable = &buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().; |
| 43 | for _ in -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1025..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1025 { |
| 44 | 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().(leb128rust-analyzer cargo leb128 0.2.5 crate/::readrust-analyzer cargo leb128 0.2.5 read/::signedrust-analyzer cargo leb128 0.2.5 read/signed().(&mut readable).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 45 | } |
| 46 | }); |
| 47 | } |
| 48 | |
| 49 | #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:] |
| 50 | fn read_unsignedrust-analyzer cargo leb128 0.2.5 read_unsigned().(b: &mut testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) { |
| 51 | let mut buf = [0; 4096]; |
| 52 | |
| 53 | { |
| 54 | let mut writable = &mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().; |
| 55 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#2050 { |
| 56 | leb128rust-analyzer cargo leb128 0.2.5 crate/::writerust-analyzer cargo leb128 0.2.5 write/::unsignedrust-analyzer cargo leb128 0.2.5 write/unsigned().(&mut writable, i).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| { |
| 61 | let mut readable = &buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().; |
| 62 | for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#2050 { |
| 63 | 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().(leb128rust-analyzer cargo leb128 0.2.5 crate/::readrust-analyzer cargo leb128 0.2.5 read/::unsignedrust-analyzer cargo leb128 0.2.5 read/unsigned().(&mut readable).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 64 | } |
| 65 | }); |
| 66 | } |