test: expose internals for benchmarking
This commit is a bit of a hack. The first thing I could think of. The problem is that I want to be able to benchmark various modules in the read buffer but I don't want to expose those internals via the external API. Becuase criterion only lets you exercise the exported API I needed to expose some internals. I did this by creating a documented module `benchmarks` in the `read_buffer` crate, which re-exports identifiers that can be used by a criterion crate. The idea is that it will be clear that this module is not part of the public API.pull/24376/head
parent
d55bc4835a
commit
c6ff633afd
|
@ -3,7 +3,7 @@ use rand::distributions::Alphanumeric;
|
|||
use rand::prelude::*;
|
||||
use rand::Rng;
|
||||
|
||||
use read_buffer::{column::cmp::Operator, column::dictionary, column::RowIDs};
|
||||
use read_buffer::benchmarks::{dictionary, Operator, RowIDs};
|
||||
|
||||
const ROWS: [usize; 3] = [100_000, 1_000_000, 10_000_000];
|
||||
const LOCATIONS: [Location; 3] = [Location::Start, Location::Middle, Location::End];
|
||||
|
|
|
@ -4,8 +4,8 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Through
|
|||
use rand::prelude::*;
|
||||
|
||||
use arrow_deps::arrow::datatypes::*;
|
||||
use read_buffer::column::fixed::Fixed;
|
||||
use read_buffer::column::fixed_null::FixedNull;
|
||||
use read_buffer::benchmarks::Fixed;
|
||||
use read_buffer::benchmarks::FixedNull;
|
||||
|
||||
const ROWS: [usize; 5] = [10, 100, 1_000, 10_000, 60_000];
|
||||
const CHUNKS: [Chunks; 4] = [
|
||||
|
|
|
@ -4,8 +4,8 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Through
|
|||
use rand::prelude::*;
|
||||
|
||||
use arrow_deps::arrow::datatypes::*;
|
||||
use read_buffer::column::fixed::Fixed;
|
||||
use read_buffer::column::fixed_null::FixedNull;
|
||||
use read_buffer::benchmarks::Fixed;
|
||||
use read_buffer::benchmarks::FixedNull;
|
||||
|
||||
const ROWS: [usize; 5] = [10, 100, 1_000, 10_000, 60_000];
|
||||
const CHUNKS: [Chunks; 4] = [
|
||||
|
|
|
@ -7,9 +7,8 @@ use rand::Rng;
|
|||
use rand_distr::{Distribution, Normal};
|
||||
|
||||
use packers::{sorter, Packers};
|
||||
|
||||
use read_buffer::column::{AggregateType, Column};
|
||||
use read_buffer::row_group::{ColumnType, Predicate, RowGroup};
|
||||
use read_buffer::benchmarks::{Column, ColumnType, RowGroup};
|
||||
use read_buffer::{AggregateType, Predicate};
|
||||
|
||||
const ONE_MS: i64 = 1_000_000;
|
||||
|
||||
|
|
|
@ -1017,3 +1017,17 @@ mod test {
|
|||
assert!(itr.next().is_none());
|
||||
}
|
||||
}
|
||||
|
||||
/// THIS MODULE SHOULD ONLY BE IMPORTED FOR BENCHMARKS.
|
||||
///
|
||||
/// This module lets us expose internal parts of the crate so that we can use
|
||||
/// libraries like criterion for benchmarking.
|
||||
///
|
||||
/// It should not be imported into any non-testing or benchmarking crates.
|
||||
pub mod benchmarks {
|
||||
pub use crate::column::{
|
||||
cmp::Operator, dictionary, fixed::Fixed, fixed_null::FixedNull, Column, RowIDs,
|
||||
};
|
||||
|
||||
pub use crate::row_group::{ColumnType, RowGroup};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue