summaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2023-06-26 10:09:46 -0400
committerDouglas Rumbaugh <dbr4@psu.edu>2023-06-26 10:09:46 -0400
commit9864552a3f2b533c47076a7f6efe246e77deb440 (patch)
treefe048914cae002e88a21fb20ea1c1897d4662b92 /benchmarks
parent05642ae192f50e7a40dc198451545f03f6b4d79a (diff)
downloaddynamic-extension-9864552a3f2b533c47076a7f6efe246e77deb440.tar.gz
Added static benchmarking
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/include/bench.h41
-rw-r--r--benchmarks/triespline_rq_bench.cpp8
2 files changed, 49 insertions, 0 deletions
diff --git a/benchmarks/include/bench.h b/benchmarks/include/bench.h
index 6a9c263..db8fc77 100644
--- a/benchmarks/include/bench.h
+++ b/benchmarks/include/bench.h
@@ -108,3 +108,44 @@ static bool query_latency_bench(DE &de_index, std::vector<QP> queries, size_t tr
return true;
}
+
+
+template <typename Shard, de::RecordInterface R, typename QP, QueryInterface Q, bool PROGRESS=true>
+static bool static_latency_bench(Shard *shard, std::vector<QP> queries, size_t trial_cnt=100) {
+ char progbuf[25];
+ if constexpr (PROGRESS) {
+ sprintf(progbuf, "querying:");
+ }
+
+ size_t total_time = 0;
+ size_t total_results = 0;
+
+ for (size_t i=0; i<trial_cnt; i++) {
+ if constexpr (PROGRESS) {
+ progress_update((double) (i) / (double) trial_cnt, progbuf);
+ }
+
+ std::vector<void *> states(1);
+
+ auto start = std::chrono::high_resolution_clock::now();
+ for (size_t j=0; j<queries.size(); j++) {
+ states[0] = Q::get_query_state(shard, &queries[i]);
+ Q::process_query_states(shard, states, nullptr);
+ auto res = Q::query(shard, states[0], &queries[i]);
+ total_results += res.size();
+ Q::delete_query_state(states[0]);
+ }
+ auto stop = std::chrono::high_resolution_clock::now();
+
+ total_time += std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start).count();
+ }
+
+ progress_update(1.0, progbuf);
+
+ size_t query_latency = total_time / (trial_cnt * queries.size());
+
+ fprintf(stdout, "%ld\t", query_latency);
+ fflush(stdout);
+
+ return true;
+}
diff --git a/benchmarks/triespline_rq_bench.cpp b/benchmarks/triespline_rq_bench.cpp
index cc7bae4..9ee8ad9 100644
--- a/benchmarks/triespline_rq_bench.cpp
+++ b/benchmarks/triespline_rq_bench.cpp
@@ -45,8 +45,16 @@ int main(int argc, char **argv)
insert_tput_bench<ExtendedTSRQ, Rec>(de, datafile, insert_cnt, delete_prop, to_delete);
query_latency_bench<ExtendedTSRQ, Rec, de::ts_range_query_parms<Rec>>(de, queries);
+
+ auto ts = de.create_static_structure();
+
+ static_latency_bench<de::TrieSpline<Rec>, Rec, de::ts_range_query_parms<Rec>, de::TrieSplineRangeQuery<Rec>>(
+ ts, queries
+ );
fprintf(stdout, "\n");
+ delete ts;
+
delete_bench_env();
fflush(stdout);
fflush(stderr);