<commit_before>use std::convert::TryInto;
use array_init::array_init;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use uu_factor::{table::*, Factors};

fn table(c: &mut Criterion) {
    const INPUT_SIZE: usize = 128;
    assert!(
        INPUT_SIZE % CHUNK_SIZE == 0,
        "INPUT_SIZE ({}) is not divisible by CHUNK_SIZE ({})",
        INPUT_SIZE,
        CHUNK_SIZE
    );
    let inputs = {
        // Deterministic RNG; use an explicitely-named RNG to guarantee stability
        use rand::{RngCore, SeedableRng};
        use rand_chacha::ChaCha8Rng;
        const SEED: u64 = 0xdead_bebe_ea75_cafe;
        let mut rng = ChaCha8Rng::seed_from_u64(SEED);

        std::iter::repeat_with(move || array_init::<_, _, INPUT_SIZE>(|_| rng.next_u64()))
    };

    let mut group = c.benchmark_group("table");<commit_msg>factor::benches::table: Report throughput (in numbers/s)<commit_after>use array_init::array_init;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use std::convert::TryInto;
use uu_factor::{table::*, Factors};

fn table(c: &mut Criterion) {
    const INPUT_SIZE: usize = 128;
    assert!(
        INPUT_SIZE % CHUNK_SIZE == 0,
        "INPUT_SIZE ({}) is not divisible by CHUNK_SIZE ({})",
        INPUT_SIZE,
        CHUNK_SIZE
    );
    let inputs = {
        // Deterministic RNG; use an explicitely-named RNG to guarantee stability
        use rand::{RngCore, SeedableRng};
        use rand_chacha::ChaCha8Rng;
        const SEED: u64 = 0xdead_bebe_ea75_cafe;
        let mut rng = ChaCha8Rng::seed_from_u64(SEED);

        std::iter::repeat_with(move || array_init::<_, _, INPUT_SIZE>(|_| rng.next_u64()))
    };

    let mut group = c.benchmark_group("table");
    group.throughput(Throughput::Elements(INPUT_SIZE as _));
{'fraction_non_alphanumeric': 0.1306504961411246, 'fraction_numerical': 0.016538037486218304, 'mean_word_length': 3.5717884130982367, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2244694', 'n_tokens_mistral': 662, 'n_tokens_neox': 619, 'n_words': 134}