fn optimap_collision_benchmark() {
        let mut rng = rand::thread_rng();

        // test parameters
        let key_count = 8192;
        let key_size = 128;
        let bucket_count = key_count / 4;
        let put_count: usize = 1000000;
        let get_count: usize = 1000000;
        let del_count: usize = 50000;

        let keys = gen_rand_strings(key_count, key_size);

        let init = keys.iter()
            .map(|k| Task::Put(k.clone(), rng.gen::<u64>()))
            .collect::<Vec<_>>();

        let workloads = core_affinity::get_core_ids().unwrap().into_iter()
            .skip(1)
            .map(|_| {
                let tasks = (0..(put_count + get_count + del_count)).map(|i| {
                    let key = keys[rng.gen::<usize>() % keys.len()].clone();

                    if i < put_count {
                        Task::Get(key)
                    } else if i < put_count + get_count {
                        Task::Put(key, rng.gen::<u64>())
                    } else {
                        Task::Remove(key)
                    }
                }).collect();

                Arc::new(tasks)
            }).collect::<Vec<Arc<_>>>();

        BenchRunner::run_benchmark("balanced_collision", bucket_count, workloads, init);
    }
// TODO: improve this by balancing puts and gets across cores
improve this by balancing puts and gets across cores
improve this by balancing puts and gets across cores
fn optimap_collision_benchmark() {
        let mut rng = rand::thread_rng();
        // test parameters
        let key_count = 8192;
        let key_size = 128;
        let bucket_count = key_count / 4;
        let put_count: usize = 1000000;
        let get_count: usize = 1000000;
        let del_count: usize = 50000;
        let keys = gen_rand_strings(key_count, key_size);
        let init = keys.iter()
            .map(|k| Task::Put(k.clone(), rng.gen::<u64>()))
            .collect::<Vec<_>>();
        let workloads = core_affinity::get_core_ids().unwrap().into_iter()
            .skip(1)
            .map(|_| {
                let tasks = (0..(put_count + get_count + del_count)).map(|i| {
                    let key = keys[rng.gen::<usize>() % keys.len()].clone();
                    if i < put_count {
                        Task::Get(key)
                    } else if i < put_count + get_count {
                        Task::Put(key, rng.gen::<u64>())
                    } else {
                        Task::Remove(key)
                    }
                }).collect();
                Arc::new(tasks)
            }).collect::<Vec<Arc<_>>>();
        BenchRunner::run_benchmark("balanced_collision", bucket_count, workloads, init);
    }
fn optimap_collision_benchmark ( ) { let mut rng = rand :: thread_rng ( ) ; // test parameters let key_count = 8192 ; let key_size = 128 ; let bucket_count = key_count / 4 ; let put_count : usize = 1000000 ; let get_count : usize = 1000000 ; let del_count : usize = 50000 ; let keys = gen_rand_strings ( key_count , key_size ) ; let init = keys . iter ( ) . map ( | k | Task :: Put ( k . clone ( ) , rng . gen :: < u64 > ( ) ) ) . collect :: < Vec < _ > > ( ) ; let workloads = core_affinity :: get_core_ids ( ) . unwrap ( ) . into_iter ( ) . skip ( 1 ) . map ( | _ | { let tasks = ( 0 .. ( put_count + get_count + del_count ) ) . map ( | i | { let key = keys [ rng . gen :: < usize > ( ) % keys . len ( ) ] . clone ( ) ; if i < put_count { Task :: Get ( key ) } else if i < put_count + get_count { Task :: Put ( key , rng . gen :: < u64 > ( ) ) } else { Task :: Remove ( key ) } } ) . collect ( ) ; Arc :: new ( tasks ) } ) . collect :: < Vec < Arc < _ > > > ( ) ; BenchRunner :: run_benchmark ( " " , bucket_count , workloads , init ) ; }
TODO: improve this by balancing puts and gets across cores
TODO : improve this by balancing puts and gets across cores