Use pk
This commit is contained in:
parent
5f5d839f0c
commit
884831ece5
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "btree_map.hpp"
|
#include "btree_map.hpp"
|
||||||
#include "coordinator/hybrid_logical_clock.hpp"
|
#include "coordinator/hybrid_logical_clock.hpp"
|
||||||
|
#include "storage/v3/key_store.hpp"
|
||||||
#include "storage/v3/lexicographically_ordered_vertex.hpp"
|
#include "storage/v3/lexicographically_ordered_vertex.hpp"
|
||||||
#include "storage/v3/mvcc.hpp"
|
#include "storage/v3/mvcc.hpp"
|
||||||
#include "storage/v3/transaction.hpp"
|
#include "storage/v3/transaction.hpp"
|
||||||
@ -32,7 +33,7 @@ inline void PrepareData(utils::SkipList<T> &skip_list, const int64_t num_element
|
|||||||
auto *delta = storage::v3::CreateDeleteObjectDelta(&transaction);
|
auto *delta = storage::v3::CreateDeleteObjectDelta(&transaction);
|
||||||
for (auto i{0}; i < num_elements; ++i) {
|
for (auto i{0}; i < num_elements; ++i) {
|
||||||
auto acc = skip_list.access();
|
auto acc = skip_list.access();
|
||||||
acc.insert({storage::v3::Vertex(delta, std::vector<storage::v3::PropertyValue>{storage::v3::PropertyValue{i}})});
|
acc.insert({storage::v3::PrimaryKey{storage::v3::PropertyValue{i}}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +57,7 @@ inline void PrepareData(std::set<T> &std_set, const int64_t num_elements) {
|
|||||||
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
||||||
auto *delta = storage::v3::CreateDeleteObjectDelta(&transaction);
|
auto *delta = storage::v3::CreateDeleteObjectDelta(&transaction);
|
||||||
for (auto i{0}; i < num_elements; ++i) {
|
for (auto i{0}; i < num_elements; ++i) {
|
||||||
std_set.insert(storage::v3::LexicographicallyOrderedVertex{
|
std_set.insert(std::vector<storage::v3::PropertyValue>{storage::v3::PropertyValue{i}});
|
||||||
storage::v3::Vertex{delta, std::vector<storage::v3::PropertyValue>{storage::v3::PropertyValue{i}}}});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace memgraph::benchmark {
|
|||||||
// Testing Contains Operation
|
// Testing Contains Operation
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
static void BM_BenchmarkContainsSkipList(::benchmark::State &state) {
|
static void BM_BenchmarkContainsSkipList(::benchmark::State &state) {
|
||||||
utils::SkipList<storage::v3::LexicographicallyOrderedVertex> skip_list;
|
utils::SkipList<storage::v3::PrimaryKey> skip_list;
|
||||||
PrepareData(skip_list, state.range(0));
|
PrepareData(skip_list, state.range(0));
|
||||||
// So we can also have elements that does don't exist
|
// So we can also have elements that does don't exist
|
||||||
std::mt19937 i_generator(std::random_device{}());
|
std::mt19937 i_generator(std::random_device{}());
|
||||||
@ -77,7 +77,7 @@ static void BM_BenchmarkContainsStdMap(::benchmark::State &state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void BM_BenchmarkContainsStdSet(::benchmark::State &state) {
|
static void BM_BenchmarkContainsStdSet(::benchmark::State &state) {
|
||||||
std::set<storage::v3::LexicographicallyOrderedVertex> std_set;
|
std::set<storage::v3::PrimaryKey> std_set;
|
||||||
PrepareData(std_set, state.range(0));
|
PrepareData(std_set, state.range(0));
|
||||||
coordinator::Hlc start_timestamp;
|
coordinator::Hlc start_timestamp;
|
||||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||||
@ -90,8 +90,7 @@ static void BM_BenchmarkContainsStdSet(::benchmark::State &state) {
|
|||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto i{0}; i < state.range(0); ++i) {
|
for (auto i{0}; i < state.range(0); ++i) {
|
||||||
int64_t value = i_distribution(i_generator);
|
int64_t value = i_distribution(i_generator);
|
||||||
if (std_set.contains(storage::v3::LexicographicallyOrderedVertex{
|
if (std_set.contains(storage::v3::PrimaryKey{storage::v3::PropertyValue{value}})) {
|
||||||
storage::v3::Vertex{delta, storage::v3::PrimaryKey{storage::v3::PropertyValue{value}}}})) {
|
|
||||||
found_elems++;
|
found_elems++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace memgraph::benchmark {
|
|||||||
// Testing Find Operation
|
// Testing Find Operation
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
static void BM_BenchmarkFindSkipList(::benchmark::State &state) {
|
static void BM_BenchmarkFindSkipList(::benchmark::State &state) {
|
||||||
utils::SkipList<storage::v3::LexicographicallyOrderedVertex> skip_list;
|
utils::SkipList<storage::v3::PrimaryKey> skip_list;
|
||||||
PrepareData(skip_list, state.range(0));
|
PrepareData(skip_list, state.range(0));
|
||||||
// So we can also have elements that does don't exist
|
// So we can also have elements that does don't exist
|
||||||
std::mt19937 i_generator(std::random_device{}());
|
std::mt19937 i_generator(std::random_device{}());
|
||||||
@ -76,7 +76,7 @@ static void BM_BenchmarkFindStdMap(::benchmark::State &state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void BM_BenchmarkFindStdSet(::benchmark::State &state) {
|
static void BM_BenchmarkFindStdSet(::benchmark::State &state) {
|
||||||
std::set<storage::v3::LexicographicallyOrderedVertex> std_set;
|
std::set<storage::v3::PrimaryKey> std_set;
|
||||||
PrepareData(std_set, state.range(0));
|
PrepareData(std_set, state.range(0));
|
||||||
coordinator::Hlc start_timestamp;
|
coordinator::Hlc start_timestamp;
|
||||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||||
@ -90,8 +90,7 @@ static void BM_BenchmarkFindStdSet(::benchmark::State &state) {
|
|||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto i{0}; i < state.range(0); ++i) {
|
for (auto i{0}; i < state.range(0); ++i) {
|
||||||
int64_t value = i_distribution(i_generator);
|
int64_t value = i_distribution(i_generator);
|
||||||
if (std_set.find(storage::v3::LexicographicallyOrderedVertex{storage::v3::Vertex{
|
if (std_set.find(storage::v3::PrimaryKey{storage::v3::PropertyValue{value}}) != std_set.end()) {
|
||||||
delta, storage::v3::PrimaryKey{storage::v3::PropertyValue{value}}}}) != std_set.end()) {
|
|
||||||
found_elems++;
|
found_elems++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ namespace memgraph::benchmark {
|
|||||||
// Testing Insert Operation
|
// Testing Insert Operation
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
static void BM_BenchmarkInsertSkipList(::benchmark::State &state) {
|
static void BM_BenchmarkInsertSkipList(::benchmark::State &state) {
|
||||||
utils::SkipList<storage::v3::LexicographicallyOrderedVertex> skip_list;
|
utils::SkipList<storage::v3::PrimaryKey> skip_list;
|
||||||
coordinator::Hlc start_timestamp;
|
coordinator::Hlc start_timestamp;
|
||||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||||
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
||||||
@ -47,7 +47,7 @@ static void BM_BenchmarkInsertSkipList(::benchmark::State &state) {
|
|||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto i{0}; i < state.range(0); ++i) {
|
for (auto i{0}; i < state.range(0); ++i) {
|
||||||
auto acc = skip_list.access();
|
auto acc = skip_list.access();
|
||||||
acc.insert({storage::v3::Vertex(delta, std::vector<storage::v3::PropertyValue>{storage::v3::PropertyValue{i}})});
|
acc.insert({storage::v3::PrimaryKey{storage::v3::PropertyValue{i}}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ static void BM_BenchmarkInsertStdMap(::benchmark::State &state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void BM_BenchmarkInsertStdSet(::benchmark::State &state) {
|
static void BM_BenchmarkInsertStdSet(::benchmark::State &state) {
|
||||||
std::set<storage::v3::LexicographicallyOrderedVertex> std_set;
|
std::set<storage::v3::PrimaryKey> std_set;
|
||||||
coordinator::Hlc start_timestamp;
|
coordinator::Hlc start_timestamp;
|
||||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||||
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
||||||
@ -77,8 +77,7 @@ static void BM_BenchmarkInsertStdSet(::benchmark::State &state) {
|
|||||||
|
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto i{0}; i < state.range(0); ++i) {
|
for (auto i{0}; i < state.range(0); ++i) {
|
||||||
std_set.insert(storage::v3::LexicographicallyOrderedVertex{
|
std_set.insert(storage::v3::PrimaryKey{std::vector<storage::v3::PropertyValue>{storage::v3::PropertyValue{i}}});
|
||||||
storage::v3::Vertex{delta, std::vector<storage::v3::PropertyValue>{storage::v3::PropertyValue{i}}}});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace memgraph::benchmark {
|
|||||||
// Testing Remove Operation
|
// Testing Remove Operation
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
static void BM_BenchmarkRemoveSkipList(::benchmark::State &state) {
|
static void BM_BenchmarkRemoveSkipList(::benchmark::State &state) {
|
||||||
utils::SkipList<storage::v3::LexicographicallyOrderedVertex> skip_list;
|
utils::SkipList<storage::v3::PrimaryKey> skip_list;
|
||||||
PrepareData(skip_list, state.range(0));
|
PrepareData(skip_list, state.range(0));
|
||||||
coordinator::Hlc start_timestamp;
|
coordinator::Hlc start_timestamp;
|
||||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||||
@ -54,8 +54,7 @@ static void BM_BenchmarkRemoveSkipList(::benchmark::State &state) {
|
|||||||
for (auto i{0}; i < state.range(0); ++i) {
|
for (auto i{0}; i < state.range(0); ++i) {
|
||||||
int64_t value = i_distribution(i_generator);
|
int64_t value = i_distribution(i_generator);
|
||||||
auto acc = skip_list.access();
|
auto acc = skip_list.access();
|
||||||
if (acc.remove(storage::v3::LexicographicallyOrderedVertex{
|
if (acc.remove(storage::v3::PrimaryKey{storage::v3::PropertyValue(value)})) {
|
||||||
storage::v3::Vertex{delta, storage::v3::PrimaryKey{storage::v3::PropertyValue(value)}}})) {
|
|
||||||
removed_elems++;
|
removed_elems++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +82,7 @@ static void BM_BenchmarkRemoveStdMap(::benchmark::State &state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void BM_BenchmarkRemoveStdSet(::benchmark::State &state) {
|
static void BM_BenchmarkRemoveStdSet(::benchmark::State &state) {
|
||||||
std::set<storage::v3::LexicographicallyOrderedVertex> std_set;
|
std::set<storage::v3::PrimaryKey> std_set;
|
||||||
PrepareData(std_set, state.range(0));
|
PrepareData(std_set, state.range(0));
|
||||||
coordinator::Hlc start_timestamp;
|
coordinator::Hlc start_timestamp;
|
||||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||||
@ -97,8 +96,7 @@ static void BM_BenchmarkRemoveStdSet(::benchmark::State &state) {
|
|||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto i{0}; i < state.range(0); ++i) {
|
for (auto i{0}; i < state.range(0); ++i) {
|
||||||
int64_t value = i_distribution(i_generator);
|
int64_t value = i_distribution(i_generator);
|
||||||
if (std_set.erase(storage::v3::LexicographicallyOrderedVertex{
|
if (std_set.erase(storage::v3::PrimaryKey{storage::v3::PropertyValue{value}}) > 0) {
|
||||||
storage::v3::Vertex{delta, {storage::v3::PropertyValue{value}}}}) > 0) {
|
|
||||||
removed_elems++;
|
removed_elems++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user