From f6a846a864112cd0df686138fae89c727e8771ab Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Sun, 23 Jul 2023 15:38:04 -0400 Subject: BTree-based baselines for IRS and Range queries --- benchmarks/include/bench.h | 6 +++++- benchmarks/include/bench_utility.h | 31 +++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) (limited to 'benchmarks/include') diff --git a/benchmarks/include/bench.h b/benchmarks/include/bench.h index e0f4c1d..28c1e97 100644 --- a/benchmarks/include/bench.h +++ b/benchmarks/include/bench.h @@ -49,7 +49,11 @@ static bool insert_tput_bench(DE &de_index, std::fstream &file, size_t insert_cn for (size_t i=0; i) { + de_index.erase_one(delete_vec[delete_idx++].key); + } else { + de_index.erase(delete_vec[delete_idx++]); + } applied_deletes++; } diff --git a/benchmarks/include/bench_utility.h b/benchmarks/include/bench_utility.h index a5f5e0b..cc926a3 100644 --- a/benchmarks/include/bench_utility.h +++ b/benchmarks/include/bench_utility.h @@ -14,6 +14,7 @@ #include "shard/PGM.h" #include "shard/TrieSpline.h" #include "shard/WIRS.h" +#include "ds/BTree.h" #include #include @@ -42,6 +43,28 @@ typedef de::DynamicExtension, de::PGMRangeQuery> Extended typedef de::DynamicExtension, de::IRSQuery> ExtendedISAM_IRS; typedef de::DynamicExtension, de::ISAMRangeQuery> ExtendedISAM_RQ; +struct btree_record { + key_type key; + value_type value; + + inline bool operator<(const btree_record& other) const { + return key < other.key || (key == other.key && value < other.value); + } + + inline bool operator==(const btree_record& other) const { + return key == other.key && value == other.value; + } +}; + +struct btree_key_extract { + static const key_type &get(const btree_record &v) { + return v.key; + } +}; + +typedef tlx::BTree TreeMap; + + static gsl_rng *g_rng; static std::set *g_to_delete; static bool g_osm_data; @@ -246,7 +269,7 @@ static bool warmup(std::fstream &file, DE &extended_index, size_t count, size_t inserted = 0; size_t delete_idx = 0; - + double last_percent = 0; while (inserted < count) { // Build vector of records to insert and potentially delete @@ -259,7 +282,11 @@ static bool warmup(std::fstream &file, DE &extended_index, size_t count, for (size_t i=0; i) { + extended_index.erase_one(delete_vec[delete_idx++].key); + } else { + extended_index.erase(delete_vec[delete_idx++]); + } } // insert the record; -- cgit v1.2.3