Skip to content
Snippets Groups Projects
Commit 7f2af6bb authored by Per Fuchs's avatar Per Fuchs
Browse files

Removes syncing of single threaded index baselines for analytics

parent 8916c148
No related branches found
Tags version.3
No related merge requests found
......@@ -25,6 +25,7 @@ namespace microbenchmarks {
if (sorted) {
make_sorted();
}
index->stop_sync();
}
size_t vertex_count() const override {
......
......@@ -18,6 +18,12 @@ namespace microbenchmarks::indices {
virtual VR& get_vertex_record(vertex_id_t v) = 0;
virtual bool has_vertex(vertex_id_t v) const = 0;
virtual VR& insert_vertex(vertex_id_t v) = 0;
/**
* Stops thread synchronization on the index. Can be used on single threaded baselines after insertions finished to avoid
* measuring the overhead of a single contented lock.
*/
virtual void stop_sync() { /* NOP */ };
};
};
......
......@@ -36,8 +36,16 @@ namespace microbenchmarks::indices {
}
VR &get_vertex_record(vertex_id_t v) {
shared_lock<shared_mutex> l(lock);
return index.at(v);
if (no_sync) {
return index.at(v);
} else {
shared_lock <shared_mutex> l(lock);
return index.at(v);
}
}
void stop_sync() override {
no_sync = true;
}
size_t vertex_count() const {
......@@ -52,6 +60,7 @@ namespace microbenchmarks::indices {
private:
robin_hood::unordered_map<vertex_id_t, VR> index;
atomic <size_t> vertex_counter = 0;
bool no_sync = false;
mutable shared_mutex lock;
};
}
......
......@@ -24,6 +24,7 @@ namespace microbenchmarks::indices {
TreeIndex() : AdjacencyIndex<VR>() {
cout << "Running with tree index" << endl;
}
VR &insert_vertex(vertex_id_t v) override {
scoped_lock<shared_mutex> l(lock);
auto[iter, inserted] = index.insert({v, VR()});
......@@ -35,8 +36,16 @@ namespace microbenchmarks::indices {
}
VR &get_vertex_record(vertex_id_t v) {
shared_lock <shared_mutex> l(lock);
return index.at(v);
if (no_sync) {
return index.at(v);
} else {
shared_lock <shared_mutex> l(lock);
return index.at(v);
}
}
void stop_sync() override {
no_sync = true;
}
size_t vertex_count() const {
......@@ -51,6 +60,7 @@ namespace microbenchmarks::indices {
private:
map<vertex_id_t, VR> index;
atomic <size_t> vertex_counter = 0;
bool no_sync = false;
mutable shared_mutex lock;
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment