fn beats(c: &mut Criterion) {

    let mut group = c.benchmark_group("Beats");
    let dj = TheDJ::init().unwrap();  
    
    // Single beat /////////////////////////////////////////////////////
    let beat = dj.spin_new("SingleBeatBench".to_string()).unwrap();
    group.bench_function("single_beat", |b| b.iter(|| beat.now()));
    let _ = dj.clear_all();

    // Many beats ///////////////////////////////////////////////////////

    // Config
    let count = 99;
    let timeout = Duration::from_secs(120);

    // Set up    
    let mut beats: Vec<Beat> = Vec::new();
    for n in 0..count {
        beats.push(dj.spin_new(format!("BenchTest#{}", n)).unwrap());
    }

    // Execute
    let func = || {
        beats.iter().for_each(|b| { let _ = b.now(); });
        dj.block_for_beats(count, timeout).expect("not blocked");
    };
    group.bench_function("many_beats", |b| b.iter(|| func()));
}
// Bench group that focuses on the beat operations 
Bench group that focuses on the beat operations
Bench group that focuses on the beat operations
fn beats(c: &mut Criterion) {
    let mut group = c.benchmark_group("Beats");
    let dj = TheDJ::init().unwrap();  
    // Single beat /////////////////////////////////////////////////////
    let beat = dj.spin_new("SingleBeatBench".to_string()).unwrap();
    group.bench_function("single_beat", |b| b.iter(|| beat.now()));
    let _ = dj.clear_all();
    // Many beats ///////////////////////////////////////////////////////
    // Config
    let count = 99;
    let timeout = Duration::from_secs(120);
    // Set up    
    let mut beats: Vec<Beat> = Vec::new();
    for n in 0..count {
        beats.push(dj.spin_new(format!("BenchTest#{}", n)).unwrap());
    }
    // Execute
    let func = || {
        beats.iter().for_each(|b| { let _ = b.now(); });
        dj.block_for_beats(count, timeout).expect("not blocked");
    };
    group.bench_function("many_beats", |b| b.iter(|| func()));
}
fn beats ( c : & mut Criterion ) { let mut group = c . benchmark_group ( " " ) ; let dj = TheDJ :: init ( ) . unwrap ( ) ; // Single beat ///////////////////////////////////////////////////// let beat = dj . spin_new ( " " . to_string ( ) ) . unwrap ( ) ; group . bench_function ( " " , | b | b . iter ( | | beat . now ( ) ) ) ; let _ = dj . clear_all ( ) ; // Many beats /////////////////////////////////////////////////////// // Config let count = 99 ; let timeout = Duration :: from_secs ( 120 ) ; // Set up     let mut beats : Vec < Beat > = Vec :: new ( ) ; for n in 0 .. count { beats . push ( dj . spin_new ( format ! ( " " n ) ) . unwrap ( ) ) ; } // Execute let func = | | { beats . iter ( ) . for_each ( | b | { let _ = b . now ( ) ; } ) ; dj . block_for_beats ( count , timeout ) . expect ( " " ) ; } ; group . bench_function ( " " , | b | b . iter ( | | func ( ) ) ) ; }
Bench group that focuses on the beat operations
Bench group that focuses on the beat operations
c
&mut Criterion
c
&mut Criterion