<commit_before>#![feature(test)]
extern crate adapton;
extern crate test;
use self::test::Bencher;
use adapton::trie::*;
use adapton::engine::*;

// The code that we want to compare/measure under naive versus DCG engines:
fn doit(v: Vec<usize>, t: Trie<usize>) -> Trie<usize> {
    v.into_iter().fold(t, |acc, i| TrieIntro::extend(name_of_usize(i), acc, i))
}

fn bench_naive_add_dups() {
    init_naive();
    let mut naive_input: Trie<usize> = SetIntro::empty();
    let mut v = Vec::new();

    let mut ones = vec![1;100];
    let mut twos = vec![2;100];
    let mut threes = vec![3;100];
    twos.append(&mut threes);
    ones.append(&mut twos);
    for i in ones.iter() {
        v.push(*i);
        naive_input = doit(v.clone(), naive_input.clone())<commit_msg>Wrap extensions in benchmark in articulation point for fast comparison<commit_after>#![feature(test)]
extern crate adapton;
extern crate test;
use self::test::Bencher;
use adapton::trie::*;
use adapton::engine::*;

// The code that we want to compare/measure under naive versus DCG engines:
fn doit(v: Vec<usize>, t: Trie<usize>) -> Trie<usize> {
    v.into_iter().fold(t, |acc, i| {
        let t = Trie::art(cell(name_of_usize(i), acc));
        let t = Trie::name(name_of_usize(i), t);
        Trie::extend(name_of_usize(i), t, i)
    })
}

fn bench_naive_add_dups() {
    init_naive();
    let mut naive_input: Trie<usize> = SetIntro::empty();
    let mut v = Vec::new();

    let mut ones = vec![1;100];
    let mut twos = vec![2;100];
    let mut threes = vec![3;100];
    twos.append(&mut threes);
    ones.append(&mut twos);
    for i in ones.iter() {
        v.push(*i);
        naive_input = doit(v.clone(), naive_input.clone())
{'fraction_non_alphanumeric': 0.1689149560117302, 'fraction_numerical': 0.01407624633431085, 'mean_word_length': 3.738888888888889, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '78296', 'n_tokens_mistral': 658, 'n_tokens_neox': 628, 'n_words': 162}