| 1 | #[macro_use] |
| 2 | extern crate criterionrust-analyzer cargo lab 0.11.0 criterion/; |
| 3 | #[macro_use] |
| 4 | extern crate lazy_staticrust-analyzer cargo lab 0.11.0 lazy_static/; |
| 5 | extern crate labrust-analyzer cargo lab 0.11.0 lab/; |
| 6 | extern crate randrust-analyzer cargo lab 0.11.0 rand/; |
| 7 | |
| 8 | use criterionrust-analyzer cargo criterion 0.3.6 crate/::Criterionrust-analyzer cargo criterion 0.3.6 Criterion#; |
| 9 | use randrust-analyzer cargo rand 0.8.7 crate/::distributionsrust-analyzer cargo rand 0.8.7 distributions/::Standardrust-analyzer cargo rand 0.8.7 distributions/Standard#; |
| 10 | use randrust-analyzer cargo rand 0.8.7 crate/::Rngrust-analyzer cargo rand 0.8.7 rng/Rng#; |
| 11 | |
| 12 | lazy_staticrust-analyzer cargo lazy_static 1.5.0 lazy_static!! { |
| 13 | static ref RGBSrust-analyzer cargo lab 0.11.0 RGBS#: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<[u8; 3]> = { |
| 14 | let rand_seed = [0u8; 32]; |
| 15 | let rng: randrust-analyzer cargo rand 0.8.7 crate/::rngsrust-analyzer cargo rand 0.8.7 rngs/::StdRngrust-analyzer cargo rand 0.8.7 rngs/std/StdRng# = randrust-analyzer cargo rand 0.8.7 crate/::SeedableRngrust-analyzer cargo rand_core 0.6.4 SeedableRng#::from_seedrust-analyzer cargo rand 0.8.7 rngs/std/impl#[StdRng][SeedableRng]from_seed().(rand_seed); |
| 16 | rng.sample_iterrust-analyzer cargo rand 0.8.7 rng/Rng#sample_iter().(&Standardrust-analyzer cargo rand 0.8.7 distributions/Standard#).takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(512).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 17 | }; |
| 18 | static ref RGBS_FLATrust-analyzer cargo lab 0.11.0 RGBS_FLAT#: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = |
| 19 | RGBSrust-analyzer cargo lab 0.11.0 RGBS..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 20 | .foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]fold().(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(RGBSrust-analyzer cargo lab 0.11.0 RGBS..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3), |mut acc, rgb| { |
| 21 | acc.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(rgb); |
| 22 | acc |
| 23 | }); |
| 24 | } |
| 25 | |
| 26 | fn rgbs_to_labsrust-analyzer cargo lab 0.11.0 rgbs_to_labs().(c: &mut Criterionrust-analyzer cargo criterion 0.3.6 Criterion#) { |
| 27 | c.bench_functionrust-analyzer cargo criterion 0.3.6 impl#[`Criterion<M>`]bench_function().("[RGB] -> [Lab]", move |b| { |
| 28 | b.iterrust-analyzer cargo criterion 0.3.6 bencher/impl#[`Bencher<'a, M>`]iter().(|| labrust-analyzer cargo lab 0.11.0 crate/::__scalarrust-analyzer cargo lab 0.11.0 __scalar/::rgbs_to_labsrust-analyzer cargo lab 0.11.0 __scalar/rgbs_to_labs().(&RGBSrust-analyzer cargo lab 0.11.0 RGBS.)) |
| 29 | }); |
| 30 | } |
| 31 | |
| 32 | fn rgb_bytes_to_labsrust-analyzer cargo lab 0.11.0 rgb_bytes_to_labs().(c: &mut Criterionrust-analyzer cargo criterion 0.3.6 Criterion#) { |
| 33 | c.bench_functionrust-analyzer cargo criterion 0.3.6 impl#[`Criterion<M>`]bench_function().("[u8] -> [Lab]", move |b| { |
| 34 | b.iterrust-analyzer cargo criterion 0.3.6 bencher/impl#[`Bencher<'a, M>`]iter().(|| labrust-analyzer cargo lab 0.11.0 crate/::__scalarrust-analyzer cargo lab 0.11.0 __scalar/::rgb_bytes_to_labsrust-analyzer cargo lab 0.11.0 __scalar/rgb_bytes_to_labs().(&RGBS_FLATrust-analyzer cargo lab 0.11.0 RGBS_FLAT.)) |
| 35 | }); |
| 36 | } |
| 37 | |
| 38 | fn rgbs_to_labs_simdrust-analyzer cargo lab 0.11.0 rgbs_to_labs_simd().(c: &mut Criterionrust-analyzer cargo criterion 0.3.6 Criterion#) { |
| 39 | c.bench_functionrust-analyzer cargo criterion 0.3.6 impl#[`Criterion<M>`]bench_function().("[RGB] -> [Lab] (simd)", move |b| { |
| 40 | b.iterrust-analyzer cargo criterion 0.3.6 bencher/impl#[`Bencher<'a, M>`]iter().(|| labrust-analyzer cargo lab 0.11.0 crate/::rgbs_to_labsrust-analyzer cargo lab 0.11.0 rgbs_to_labs().(&RGBSrust-analyzer cargo lab 0.11.0 RGBS.)) |
| 41 | }); |
| 42 | } |
| 43 | |
| 44 | fn rgb_bytes_to_labs_simdrust-analyzer cargo lab 0.11.0 rgb_bytes_to_labs_simd().(c: &mut Criterionrust-analyzer cargo criterion 0.3.6 Criterion#) { |
| 45 | c.bench_functionrust-analyzer cargo criterion 0.3.6 impl#[`Criterion<M>`]bench_function().("[u8] -> [Lab] (simd)", move |b| { |
| 46 | b.iterrust-analyzer cargo criterion 0.3.6 bencher/impl#[`Bencher<'a, M>`]iter().(|| labrust-analyzer cargo lab 0.11.0 crate/::rgb_bytes_to_labsrust-analyzer cargo lab 0.11.0 rgb_bytes_to_labs().(&RGBS_FLATrust-analyzer cargo lab 0.11.0 RGBS_FLAT.)) |
| 47 | }); |
| 48 | } |
| 49 | |
| 50 | criterion_grouprust-analyzer cargo criterion 0.3.6 macros/criterion_group!!( |
| 51 | benchesrust-analyzer cargo lab 0.11.0 benches()., |
| 52 | rgbs_to_labsrust-analyzer cargo lab 0.11.0 rgbs_to_labs()., |
| 53 | rgb_bytes_to_labsrust-analyzer cargo lab 0.11.0 rgb_bytes_to_labs()., |
| 54 | rgbs_to_labs_simdrust-analyzer cargo lab 0.11.0 rgbs_to_labs_simd()., |
| 55 | rgb_bytes_to_labs_simdrust-analyzer cargo lab 0.11.0 rgb_bytes_to_labs_simd(). |
| 56 | ); |
| 57 | criterion_mainrust-analyzer cargo criterion 0.3.6 macros/criterion_main!!(benchesrust-analyzer cargo lab 0.11.0 benches().); |