summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2023-11-15 15:18:56 -0500
committerDouglas Rumbaugh <dbr4@psu.edu>2023-11-15 15:18:56 -0500
commit3680667a07d924043c5da7bba8a11883bb918b97 (patch)
tree9ea179b6a8bc03974a10e6e0221bd67c739e2ba0
parentfe12926c41eed825da80a36d77b7facd9ba0567a (diff)
downloaddynamic-extension-3680667a07d924043c5da7bba8a11883bb918b97.tar.gz
Insertion throughput benchmark
-rw-r--r--CMakeLists.txt16
-rw-r--r--benchmarks/insertion_tput.cpp49
2 files changed, 61 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d0e14c1..5ffbdb4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,9 +6,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
set(namespace "de")
project("Practical Dynamic Extension" VERSION 0.1.0)
-set(debug true)
+set(debug false)
set(tests True)
-set(bench false)
+set(bench true)
+set(old_bench False)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
@@ -21,7 +22,7 @@ if (debug)
add_compile_options(-fsanitize=undefined)
add_link_options(-fsanitize=undefined)
else()
- add_compile_options(-O3)
+ add_compile_options(-g -O3)
endif()
# Test build instructions
@@ -31,7 +32,7 @@ if (tests)
add_executable(augbtree_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/augbtree_tests.cpp)
target_link_libraries(augbtree_tests PUBLIC gsl check subunit pthread)
- target_include_directories(augbtree_tests PRIVATE include external/psudb-common/cpp/include)
+ target_include_directories(augbtree_tests PRIVATE include external/psudb-common/cpp/include external/ctpl)
add_executable(internal_level_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/internal_level_tests.cpp)
target_link_libraries(internal_level_tests PUBLIC gsl check subunit pthread)
@@ -83,6 +84,13 @@ endif()
if (bench)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin/benchmarks")
+ add_executable(insertion_tput ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/insertion_tput.cpp)
+ target_link_libraries(insertion_tput PUBLIC gsl pthread gomp)
+ target_include_directories(insertion_tput PRIVATE include external external/m-tree/cpp external/PGM-index/include external/PLEX/include bench/include external/psudb-common/cpp/include)
+ target_compile_options(insertion_tput PUBLIC -fopenmp)
+endif()
+
+if (old_bench)
add_executable(alias_wss_bench ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/alias_wss_bench.cpp)
target_link_libraries(alias_wss_bench PUBLIC gsl pthread gomp)
target_include_directories(alias_wss_bench PRIVATE include external/m-tree/cpp external/PGM-index/include external/PLEX/include bench/include)
diff --git a/benchmarks/insertion_tput.cpp b/benchmarks/insertion_tput.cpp
new file mode 100644
index 0000000..ad53443
--- /dev/null
+++ b/benchmarks/insertion_tput.cpp
@@ -0,0 +1,49 @@
+/*
+ *
+ */
+
+#define ENABLE_TIMER
+
+#include "framework/DynamicExtension.h"
+#include "shard/ISAMTree.h"
+#include "query/rangequery.h"
+#include "framework/interface/Record.h"
+
+#include "psu-util/timer.h"
+
+
+typedef de::Record<int64_t, int64_t> Rec;
+typedef de::ISAMTree<Rec> ISAM;
+typedef de::rq::Query<ISAM, Rec> Q;
+typedef de::DynamicExtension<Rec, ISAM, Q> Ext;
+
+
+
+int main(int argc, char **argv) {
+
+ auto extension = Ext(1000, 2, 1);
+
+ size_t n = 1000000;
+ size_t per_trial = 100;
+
+ std::vector<int64_t> latencies;
+
+ TIMER_INIT();
+ for (int64_t i=0; i<n; i+=per_trial) {
+ TIMER_START();
+ for (int64_t j=0; j<per_trial; j++) {
+ Rec r = {i+j, i+j};
+ extension.insert(r);
+ }
+ TIMER_STOP();
+
+ auto res = TIMER_RESULT();
+
+ latencies.push_back(TIMER_RESULT());
+ }
+
+ for (size_t i=0; i<latencies.size(); i++) {
+ fprintf(stdout, "%ld\t%ld\t%ld\n", (1+i)*per_trial, latencies[i], per_trial);
+ }
+}
+