From fc8b4c14bd2814447b5d3180c4ecf3742196c6bf Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Sun, 23 Jul 2023 14:17:38 -0400 Subject: Benchmarking updates --- benchmarks/include/bench_utility.h | 42 ++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'benchmarks/include/bench_utility.h') diff --git a/benchmarks/include/bench_utility.h b/benchmarks/include/bench_utility.h index 2d31cae..a5f5e0b 100644 --- a/benchmarks/include/bench_utility.h +++ b/benchmarks/include/bench_utility.h @@ -30,7 +30,7 @@ #include typedef uint64_t key_type; -typedef uint32_t value_type; +typedef uint64_t value_type; typedef uint64_t weight_type; typedef de::WeightedRecord WRec; @@ -39,6 +39,8 @@ typedef de::Record Rec; typedef de::DynamicExtension, de::WSSQuery> ExtendedWSS; typedef de::DynamicExtension, de::TrieSplineRangeQuery> ExtendedTSRQ; typedef de::DynamicExtension, de::PGMRangeQuery> ExtendedPGMRQ; +typedef de::DynamicExtension, de::IRSQuery> ExtendedISAM_IRS; +typedef de::DynamicExtension, de::ISAMRangeQuery> ExtendedISAM_RQ; static gsl_rng *g_rng; static std::set *g_to_delete; @@ -115,11 +117,36 @@ static std::vector read_range_queries(std::string fname, double selectivity) return queries; } -template -static bool next_record(std::fstream &file, R &record) +template +static bool next_record(std::fstream &file, R &record, bool binary=false) { + static value_type value = 1; if (g_reccnt >= g_max_record_cnt) return false; + if (binary) { + if (file.good()) { + decltype(R::key) key; + + file.read((char*) &key, sizeof(key)); + record.key = key; + record.value = value; + value++; + + if constexpr (de::WeightedRecordInterface) { + decltype(R::weight) weight; + file.read((char*) &weight, sizeof(weight)); + record.weight = weight; + } + + if (record.key < g_min_key) g_min_key = record.key; + if (record.key > g_max_key) g_max_key = record.key; + + return true; + } + + return false; + } + std::string line; if (std::getline(file, line, '\n')) { std::stringstream line_stream(line); @@ -139,7 +166,6 @@ static bool next_record(std::fstream &file, R &record) } if (record.key < g_min_key) g_min_key = record.key; - if (record.key > g_max_key) g_max_key = record.key; g_reccnt++; @@ -152,11 +178,11 @@ static bool next_record(std::fstream &file, R &record) template static bool build_insert_vec(std::fstream &file, std::vector &vec, size_t n, - double delete_prop, std::vector &to_delete) { + double delete_prop, std::vector &to_delete, bool binary=false) { vec.clear(); for (size_t i=0; i static bool warmup(std::fstream &file, DE &extended_index, size_t count, - double delete_prop, std::vector to_delete, bool progress=true) { + double delete_prop, std::vector to_delete, bool progress=true, bool binary=false) { size_t batch = std::min(.1 * count, 25000.0); std::vector insert_vec; @@ -224,7 +250,7 @@ static bool warmup(std::fstream &file, DE &extended_index, size_t count, double last_percent = 0; while (inserted < count) { // Build vector of records to insert and potentially delete - auto continue_warmup = build_insert_vec(file, insert_vec, batch, delete_prop, to_delete); + auto continue_warmup = build_insert_vec(file, insert_vec, batch, delete_prop, to_delete, binary); if (inserted > batch) { build_delete_vec(to_delete, delete_vec, batch*delete_prop); delete_idx = 0; -- cgit v1.2.3