async fn run_benchmark(name: &str, num_batches: usize, num_distinct_keys: i64, query: &str) {
    println!("-------------------");
    println!("{}", name);
    println!("-------------------");
    let batch = make_batch(num_distinct_keys);
    let total_rows = num_batches * batch.num_rows();
    println!("Benchmarking {}", query);
    println!(
        "  {} batches of {} rows = {} total rows",
        num_batches,
        batch.num_rows(),
        total_rows
    );

    let table = RepeatedTable::new(batch, num_batches);
    let table = Arc::new(table);
    run_query(table.clone(), &format!("explain {}", query)).await;

    let mut total_duration = std::time::Duration::new(0, 0);
    for _ in 0..NUM_ITERATIONS {
        let start = Instant::now();
        run_query_silently(table.clone(), query).await;
        let duration = Instant::now() - start;
        println!("Completed query in {:?}", duration);
        total_duration += duration;
    }
    let nanos_per_second: f64 = 1_000_000_000.0;
    let rows_per_second: f64 = ((total_rows as f64) / (total_duration.as_nanos() as f64))
        * nanos_per_second
        * (num_iterations as f64);

    println!("---------------");
    println!(
        "Completed {} iterations query in {:?} {} rows/sec",
        num_iterations, total_duration, rows_per_second
    );
}
/// Run the specified query and num batches
Run the specified query and num batches
Run the specified query and num batches
async fn run_benchmark(name: &str, num_batches: usize, num_distinct_keys: i64, query: &str) {
    println!("-------------------");
    println!("{}", name);
    println!("-------------------");
    let batch = make_batch(num_distinct_keys);
    let total_rows = num_batches * batch.num_rows();
    println!("Benchmarking {}", query);
    println!(
        "  {} batches of {} rows = {} total rows",
        num_batches,
        batch.num_rows(),
        total_rows
    );
    let table = RepeatedTable::new(batch, num_batches);
    let table = Arc::new(table);
    run_query(table.clone(), &format!("explain {}", query)).await;
    let mut total_duration = std::time::Duration::new(0, 0);
    for _ in 0..NUM_ITERATIONS {
        let start = Instant::now();
        run_query_silently(table.clone(), query).await;
        let duration = Instant::now() - start;
        println!("Completed query in {:?}", duration);
        total_duration += duration;
    }
    let nanos_per_second: f64 = 1_000_000_000.0;
    let rows_per_second: f64 = ((total_rows as f64) / (total_duration.as_nanos() as f64))
        * nanos_per_second
        * (num_iterations as f64);
    println!("---------------");
    println!(
        "Completed {} iterations query in {:?} {} rows/sec",
        num_iterations, total_duration, rows_per_second
    );
}
async fn run_benchmark ( name : & str , num_batches : usize , num_distinct_keys : i64 , query : & str ) { println ! ( " " ) ; println ! ( " " name ) ; println ! ( " " ) ; let batch = make_batch ( num_distinct_keys ) ; let total_rows = num_batches * batch . num_rows ( ) ; println ! ( " " query ) ; println ! ( " " num_batches batch num_rows ( ) total_rows ) ; let table = RepeatedTable :: new ( batch , num_batches ) ; let table = Arc :: new ( table ) ; run_query ( table . clone ( ) , & format ! ( " " query ) ) . await ; let mut total_duration = std :: time :: Duration :: new ( 0 , 0 ) ; for _ in 0 .. NUM_ITERATIONS { let start = Instant :: now ( ) ; run_query_silently ( table . clone ( ) , query ) . await ; let duration = Instant :: now ( ) - start ; println ! ( " " duration ) ; total_duration += duration ; } let nanos_per_second : f64 = 1_000_000_000.0 ; let rows_per_second : f64 = ( ( total_rows as f64 ) / ( total_duration . as_nanos ( ) as f64 ) ) * nanos_per_second * ( num_iterations as f64 ) ; println ! ( " " ) ; println ! ( " " num_iterations total_duration rows_per_second ) ; }
Run the specified query and num batches
Run the specified query and num batches
name
&str
num_batches
usize
num_distinct_keys
i64
query
&str
name
&str
num_batches
usize
num_distinct_keys
i64
query
&str