Address review comments
This commit is contained in:
parent
9bab26fb10
commit
e0b7d7abeb
@ -27,8 +27,7 @@ namespace memgraph::benchmark {
|
||||
template <typename T>
|
||||
inline void PrepareData(utils::SkipList<T> &skip_list, const int64_t num_elements) {
|
||||
coordinator::Hlc start_timestamp;
|
||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
||||
storage::v3::Transaction transaction{start_timestamp, storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||
for (auto i{0}; i < num_elements; ++i) {
|
||||
auto acc = skip_list.access();
|
||||
acc.insert({storage::v3::PrimaryKey{storage::v3::PropertyValue{i}}});
|
||||
@ -38,8 +37,7 @@ inline void PrepareData(utils::SkipList<T> &skip_list, const int64_t num_element
|
||||
template <typename TKey, typename TValue>
|
||||
inline void PrepareData(std::map<TKey, TValue> &std_map, const int64_t num_elements) {
|
||||
coordinator::Hlc start_timestamp;
|
||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
||||
storage::v3::Transaction transaction{start_timestamp, storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||
auto *delta = storage::v3::CreateDeleteObjectDelta(&transaction);
|
||||
for (auto i{0}; i < num_elements; ++i) {
|
||||
std_map.insert({storage::v3::PrimaryKey{storage::v3::PropertyValue{i}},
|
||||
@ -51,8 +49,7 @@ inline void PrepareData(std::map<TKey, TValue> &std_map, const int64_t num_eleme
|
||||
template <typename T>
|
||||
inline void PrepareData(std::set<T> &std_set, const int64_t num_elements) {
|
||||
coordinator::Hlc start_timestamp;
|
||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
||||
storage::v3::Transaction transaction{start_timestamp, storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||
for (auto i{0}; i < num_elements; ++i) {
|
||||
std_set.insert(std::vector<storage::v3::PropertyValue>{storage::v3::PropertyValue{i}});
|
||||
}
|
||||
|
@ -39,8 +39,7 @@ namespace memgraph::benchmark {
|
||||
static void BM_BenchmarkInsertSkipList(::benchmark::State &state) {
|
||||
utils::SkipList<storage::v3::PrimaryKey> skip_list;
|
||||
coordinator::Hlc start_timestamp;
|
||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
||||
storage::v3::Transaction transaction{start_timestamp, storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||
auto *delta = storage::v3::CreateDeleteObjectDelta(&transaction);
|
||||
|
||||
for (auto _ : state) {
|
||||
@ -54,8 +53,7 @@ static void BM_BenchmarkInsertSkipList(::benchmark::State &state) {
|
||||
static void BM_BenchmarkInsertStdMap(::benchmark::State &state) {
|
||||
std::map<storage::v3::PrimaryKey, storage::v3::LexicographicallyOrderedVertex> std_map;
|
||||
coordinator::Hlc start_timestamp;
|
||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
||||
storage::v3::Transaction transaction{start_timestamp, storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||
auto *delta = storage::v3::CreateDeleteObjectDelta(&transaction);
|
||||
|
||||
for (auto _ : state) {
|
||||
@ -69,11 +67,6 @@ static void BM_BenchmarkInsertStdMap(::benchmark::State &state) {
|
||||
|
||||
static void BM_BenchmarkInsertStdSet(::benchmark::State &state) {
|
||||
std::set<storage::v3::PrimaryKey> std_set;
|
||||
coordinator::Hlc start_timestamp;
|
||||
storage::v3::IsolationLevel isolation_level{storage::v3::IsolationLevel::SNAPSHOT_ISOLATION};
|
||||
storage::v3::Transaction transaction{start_timestamp, isolation_level};
|
||||
auto *delta = storage::v3::CreateDeleteObjectDelta(&transaction);
|
||||
|
||||
for (auto _ : state) {
|
||||
for (auto i{0}; i < state.range(0); ++i) {
|
||||
std_set.insert(storage::v3::PrimaryKey{std::vector<storage::v3::PropertyValue>{storage::v3::PropertyValue{i}}});
|
||||
|
@ -11,11 +11,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
@ -26,7 +29,7 @@ DEFINE_int32(duration, 10, "Duration of test (in seconds)");
|
||||
|
||||
struct Stats {
|
||||
uint64_t total{0};
|
||||
uint64_t succ[4] = {0, 0, 0, 0};
|
||||
std::array<uint64_t, 4> succ = {0, 0, 0, 0};
|
||||
};
|
||||
|
||||
const int OP_INSERT = 0;
|
||||
@ -99,7 +102,7 @@ inline void RunTest(std::function<void(const std::atomic<bool> &, Stats &)> test
|
||||
std::cout << " Successful find: " << stats.succ[3] << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
const auto tot = std::accumulate(stats.succ.begin(), + stats.succ.begin() + 3, 0);
|
||||
const auto tot = std::accumulate(stats.succ.begin(), +stats.succ.begin() + 3, 0);
|
||||
const auto tops = stats.total;
|
||||
|
||||
std::cout << "Total successful: " << tot << " (" << tot / FLAGS_duration << " calls/s)" << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user