Skip to content

Commit

Permalink
chore(common): add more benchmark cases for hash key (#8993)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel authored Apr 4, 2023
1 parent 5d8c0b4 commit fadd752
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions src/common/benches/bench_hash_key_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct HashKeyBenchCase<K: HashKey> {

impl<K: HashKey> HashKeyBenchCase<K> {
pub fn new(id: String, input_chunk: DataChunk, data_types: Vec<DataType>) -> Self {
// please check the `bench_vec_dser` and `bench_deser` method when want to bench not full
// please reference the `bench_vec_deser` and `bench_deser` method for benchmarking partial
// `col_idxes`
let col_idxes = (0..input_chunk.columns().len()).collect_vec();
let keys = HashKey::build(&col_idxes, &input_chunk).unwrap();
Expand Down Expand Up @@ -188,6 +188,10 @@ fn case_builders() -> Vec<HashKeyBenchCaseBuilder> {
data_types: vec![DataType::Varchar],
describe: "varchar".to_string(),
},
HashKeyBenchCaseBuilder {
data_types: vec![DataType::Varchar, DataType::Varchar],
describe: "composite varchar".to_string(),
},
HashKeyBenchCaseBuilder {
data_types: vec![DataType::Int32, DataType::Int32, DataType::Int32],
describe: "composite fixed".to_string(),
Expand All @@ -198,11 +202,35 @@ fn case_builders() -> Vec<HashKeyBenchCaseBuilder> {
},
HashKeyBenchCaseBuilder {
data_types: vec![DataType::Int32, DataType::Varchar],
describe: "mix fixed and not1".to_string(),
describe: "mix fixed and not fixed, case 1".to_string(),
},
HashKeyBenchCaseBuilder {
data_types: vec![DataType::Int64, DataType::Varchar],
describe: "mix fixed and not2".to_string(),
describe: "mix fixed and not fixed, case 2".to_string(),
},
HashKeyBenchCaseBuilder {
data_types: vec![DataType::Int64; 8],
describe: "medium fixed".to_string(),
},
HashKeyBenchCaseBuilder {
data_types: {
let mut v = vec![DataType::Int64; 8];
v[7] = DataType::Varchar;
v
},
describe: "medium mixed".to_string(),
},
HashKeyBenchCaseBuilder {
data_types: vec![DataType::Int64; 16],
describe: "large fixed".to_string(),
},
HashKeyBenchCaseBuilder {
data_types: {
let mut v = vec![DataType::Int64; 16];
v[15] = DataType::Varchar;
v
},
describe: "large mixed".to_string(),
},
]
}
Expand Down

0 comments on commit fadd752

Please sign in to comment.