summaryrefslogtreecommitdiffstats
path: root/benchmarks/include
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2023-07-23 14:17:38 -0400
committerDouglas Rumbaugh <dbr4@psu.edu>2023-07-23 14:17:38 -0400
commitfc8b4c14bd2814447b5d3180c4ecf3742196c6bf (patch)
tree0496dfead96639d2813f0a364f92dec0d7871cde /benchmarks/include
parent4c616412f938bc06a12e7526c4e314e4451c083c (diff)
downloaddynamic-extension-fc8b4c14bd2814447b5d3180c4ecf3742196c6bf.tar.gz
Benchmarking updates
Diffstat (limited to 'benchmarks/include')
-rw-r--r--benchmarks/include/bench.h6
-rw-r--r--benchmarks/include/bench_utility.h42
2 files changed, 36 insertions, 12 deletions
diff --git a/benchmarks/include/bench.h b/benchmarks/include/bench.h
index 3e1c6b2..e0f4c1d 100644
--- a/benchmarks/include/bench.h
+++ b/benchmarks/include/bench.h
@@ -12,7 +12,7 @@
template <typename DE, de::RecordInterface R, bool PROGRESS=true, size_t BATCH=1000>
static bool insert_tput_bench(DE &de_index, std::fstream &file, size_t insert_cnt,
- double delete_prop, std::vector<R> &to_delete) {
+ double delete_prop, std::vector<R> &to_delete, bool binary=false) {
size_t delete_cnt = insert_cnt * delete_prop;
@@ -31,7 +31,7 @@ static bool insert_tput_bench(DE &de_index, std::fstream &file, size_t insert_cn
size_t total_time = 0;
while (applied_inserts < insert_cnt && continue_benchmark) {
- continue_benchmark = build_insert_vec(file, insert_vec, BATCH, delete_prop, to_delete);
+ continue_benchmark = build_insert_vec(file, insert_vec, BATCH, delete_prop, to_delete, binary);
if (applied_deletes < delete_cnt) {
build_delete_vec(to_delete, delete_vec, BATCH*delete_prop);
delete_idx = 0;
@@ -104,7 +104,6 @@ static bool query_latency_bench(DE &de_index, std::vector<QP> queries, size_t tr
size_t query_latency = total_time / (trial_cnt * queries.size());
fprintf(stdout, "%ld\t", query_latency);
- fprintf(stderr, "%ld\n", total_results);
fflush(stdout);
return true;
@@ -146,7 +145,6 @@ static bool static_latency_bench(Shard *shard, std::vector<QP> queries, size_t t
size_t query_latency = total_time / (trial_cnt * queries.size());
fprintf(stdout, "%ld\t", query_latency);
- fprintf(stderr, "%ld\n", total_results);
fflush(stdout);
return true;
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 <random>
typedef uint64_t key_type;
-typedef uint32_t value_type;
+typedef uint64_t value_type;
typedef uint64_t weight_type;
typedef de::WeightedRecord<key_type, value_type, weight_type> WRec;
@@ -39,6 +39,8 @@ typedef de::Record<key_type, value_type> Rec;
typedef de::DynamicExtension<WRec, de::WSS<WRec>, de::WSSQuery<WRec>> ExtendedWSS;
typedef de::DynamicExtension<Rec, de::TrieSpline<Rec>, de::TrieSplineRangeQuery<Rec>> ExtendedTSRQ;
typedef de::DynamicExtension<Rec, de::PGM<Rec>, de::PGMRangeQuery<Rec>> ExtendedPGMRQ;
+typedef de::DynamicExtension<Rec, de::MemISAM<Rec>, de::IRSQuery<Rec>> ExtendedISAM_IRS;
+typedef de::DynamicExtension<Rec, de::MemISAM<Rec>, de::ISAMRangeQuery<Rec>> ExtendedISAM_RQ;
static gsl_rng *g_rng;
static std::set<WRec> *g_to_delete;
@@ -115,11 +117,36 @@ static std::vector<QP> read_range_queries(std::string fname, double selectivity)
return queries;
}
-template <de::RecordInterface R>
-static bool next_record(std::fstream &file, R &record)
+template <de::KVPInterface R>
+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<R>) {
+ 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 <de::RecordInterface R>
static bool build_insert_vec(std::fstream &file, std::vector<R> &vec, size_t n,
- double delete_prop, std::vector<R> &to_delete) {
+ double delete_prop, std::vector<R> &to_delete, bool binary=false) {
vec.clear();
for (size_t i=0; i<n; i++) {
R rec;
- if (!next_record(file, rec)) {
+ if (!next_record(file, rec, binary)) {
if (i == 0) {
return false;
}
@@ -210,7 +236,7 @@ static void progress_update(double percentage, std::string prompt) {
template <typename DE, de::RecordInterface R>
static bool warmup(std::fstream &file, DE &extended_index, size_t count,
- double delete_prop, std::vector<R> to_delete, bool progress=true) {
+ double delete_prop, std::vector<R> to_delete, bool progress=true, bool binary=false) {
size_t batch = std::min(.1 * count, 25000.0);
std::vector<R> 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;