summaryrefslogtreecommitdiffstats
path: root/benchmarks/include/benchmark_types.h
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2024-02-23 15:40:49 -0500
committerDouglas Rumbaugh <dbr4@psu.edu>2024-02-23 15:40:49 -0500
commit69f36c9b4f5df19f09156689b333afe29a017eed (patch)
treef908ce79c7844696b08cc52c78df3e880fa7c7e7 /benchmarks/include/benchmark_types.h
parent0fcf63e9e47bae61b9f7289c157b28ec294c2e24 (diff)
downloaddynamic-extension-69f36c9b4f5df19f09156689b333afe29a017eed.tar.gz
Benchmark updates
Diffstat (limited to 'benchmarks/include/benchmark_types.h')
-rw-r--r--benchmarks/include/benchmark_types.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/benchmarks/include/benchmark_types.h b/benchmarks/include/benchmark_types.h
new file mode 100644
index 0000000..85e9565
--- /dev/null
+++ b/benchmarks/include/benchmark_types.h
@@ -0,0 +1,50 @@
+#pragma once
+
+#include <cstdlib>
+#include "psu-ds/BTree.h"
+#include "mtree.h"
+#include "framework/interface/Record.h"
+
+/* TLX BTree definitions*/
+template <typename K, typename V>
+struct btree_record {
+ K key;
+ V 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;
+ }
+};
+
+template <typename K, typename V>
+struct btree_key_extract {
+ static const K &get(const btree_record<K, V> &v) {
+ return v.key;
+ }
+};
+
+typedef psudb::BTree<int64_t, btree_record<int64_t, int64_t>, btree_key_extract<int64_t, int64_t>> BenchBTree;
+
+
+/*MTree Definitions*/
+
+const size_t W2V_SIZE = 300;
+typedef de::EuclidPoint<double, W2V_SIZE> Word2VecRec;
+
+struct euclidean_distance {
+ double operator()(const Word2VecRec &first, const Word2VecRec &second) const {
+ double dist = 0;
+ for (size_t i=0; i<W2V_SIZE; i++) {
+ dist += (first.data[i] - second.data[i]) * (first.data[i] - second.data[i]);
+ }
+
+ return std::sqrt(dist);
+ }
+};
+
+typedef mt::mtree<Word2VecRec, euclidean_distance> MTree;
+