Skip to content

Commit

Permalink
Benchmark_update (#480)
Browse files Browse the repository at this point in the history
* Added complexity to benchmark

* Added function for get NodeVector and EdgeVector
  • Loading branch information
ZigRazor authored Dec 2, 2024
1 parent 498a46f commit f98b54c
Show file tree
Hide file tree
Showing 24 changed files with 155 additions and 78 deletions.
21 changes: 12 additions & 9 deletions benchmark/BFS_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ static void BFS_X(benchmark::State &state) {
g.breadth_first_search(*(range_start->second->getNodePair().first));
}
}
BENCHMARK(BFS_X)->RangeMultiplier(18)->Range((unsigned long)1,
(unsigned long)1 << 18);
BENCHMARK(BFS_X)
->RangeMultiplier(18)
->Range((unsigned long)1, (unsigned long)1 << 18)
->Complexity();

static void BFS_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -28,7 +30,7 @@ static void BFS_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(BFS_FromReadedCitHep);
BENCHMARK(BFS_FromReadedCitHep)->Complexity();

static void PSEUDO_CONCURRENCY_BFS_X(benchmark::State &state) {
CXXGraph::Graph<int> g;
Expand All @@ -46,7 +48,8 @@ static void PSEUDO_CONCURRENCY_BFS_X(benchmark::State &state) {
}
BENCHMARK(PSEUDO_CONCURRENCY_BFS_X)
->RangeMultiplier(18)
->Range((unsigned long)1, (unsigned long)1 << 18);
->Range((unsigned long)1, (unsigned long)1 << 18)
->Complexity();

static void PSEUDO_CONCURRENCY_BFS_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -56,7 +59,7 @@ static void PSEUDO_CONCURRENCY_BFS_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(PSEUDO_CONCURRENCY_BFS_FromReadedCitHep);
BENCHMARK(PSEUDO_CONCURRENCY_BFS_FromReadedCitHep)->Complexity();

static void CONCURRENCY_BFS_X(benchmark::State &state) {
CXXGraph::Graph<int> g;
Expand All @@ -72,9 +75,9 @@ static void CONCURRENCY_BFS_X(benchmark::State &state) {
*(range_start->second->getNodePair().first), 8);
}
}
BENCHMARK(CONCURRENCY_BFS_X)
->RangeMultiplier(18)
->Range((unsigned long)1, (unsigned long)1 << 18);
// BENCHMARK(CONCURRENCY_BFS_X)
// ->RangeMultiplier(18)
// ->Range((unsigned long)1, (unsigned long)1 << 18);

static void CONCURRENCY_BFS_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -84,4 +87,4 @@ static void CONCURRENCY_BFS_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(CONCURRENCY_BFS_FromReadedCitHep);
// BENCHMARK(CONCURRENCY_BFS_FromReadedCitHep);
5 changes: 3 additions & 2 deletions benchmark/BellmanFord_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ static void BellmanFord_X(benchmark::State &state) {
}
BENCHMARK(BellmanFord_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 16);
->Range((unsigned long)1, (unsigned long)1 << 16)
->Complexity();

static void BellmanFord_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -30,4 +31,4 @@ static void BellmanFord_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(BellmanFord_FromReadedCitHep);
BENCHMARK(BellmanFord_FromReadedCitHep)->Complexity();
8 changes: 5 additions & 3 deletions benchmark/Boruvka_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ static void Boruvka_X(benchmark::State &state) {
auto &result = g.boruvka();
}
}
BENCHMARK(Boruvka_X)->RangeMultiplier(16)->Range((unsigned long)1,
(unsigned long)1 << 16);
BENCHMARK(Boruvka_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 16)
->Complexity();

static void Boruvka_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -26,4 +28,4 @@ static void Boruvka_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(Boruvka_FromReadedCitHep);
BENCHMARK(Boruvka_FromReadedCitHep)->Complexity();
10 changes: 6 additions & 4 deletions benchmark/Connectivity_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ static void Connectivity_X(benchmark::State &state) {
}
BENCHMARK(Connectivity_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 16);
->Range((unsigned long)1, (unsigned long)1 << 16)
->Complexity();

static void Connectivity_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -27,7 +28,7 @@ static void Connectivity_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(Connectivity_FromReadedCitHep);
BENCHMARK(Connectivity_FromReadedCitHep)->Complexity();

static void StrongConnectivity_X(benchmark::State &state) {
CXXGraph::Graph<int> g;
Expand All @@ -44,7 +45,8 @@ static void StrongConnectivity_X(benchmark::State &state) {
}
BENCHMARK(StrongConnectivity_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 16);
->Range((unsigned long)1, (unsigned long)1 << 16)
->Complexity();

static void StrongConnectivity_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -53,4 +55,4 @@ static void StrongConnectivity_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(StrongConnectivity_FromReadedCitHep);
BENCHMARK(StrongConnectivity_FromReadedCitHep)->Complexity();
10 changes: 6 additions & 4 deletions benchmark/CycleCheck_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ static void CycleCheckBFS_X(benchmark::State &state) {
}
BENCHMARK(CycleCheckBFS_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 16);
->Range((unsigned long)1, (unsigned long)1 << 16)
->Complexity();

static void CycleCheckBFS_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -27,7 +28,7 @@ static void CycleCheckBFS_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(CycleCheckBFS_FromReadedCitHep);
BENCHMARK(CycleCheckBFS_FromReadedCitHep)->Complexity();

static void CycleCheckDFS_X(benchmark::State &state) {
CXXGraph::Graph<int> g;
Expand All @@ -44,7 +45,8 @@ static void CycleCheckDFS_X(benchmark::State &state) {
}
BENCHMARK(CycleCheckDFS_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 16);
->Range((unsigned long)1, (unsigned long)1 << 16)
->Complexity();

static void CycleCheckDFS_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -53,4 +55,4 @@ static void CycleCheckDFS_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(CycleCheckDFS_FromReadedCitHep);
BENCHMARK(CycleCheckDFS_FromReadedCitHep)->Complexity();
8 changes: 5 additions & 3 deletions benchmark/DFS_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ static void DFS_X(benchmark::State &state) {
}
}

BENCHMARK(DFS_X)->RangeMultiplier(16)->Range((unsigned long)1,
(unsigned long)1 << 16);
BENCHMARK(DFS_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 16)
->Complexity();

static void DFS_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -29,4 +31,4 @@ static void DFS_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(DFS_FromReadedCitHep);
BENCHMARK(DFS_FromReadedCitHep)->Complexity();
8 changes: 5 additions & 3 deletions benchmark/Dial_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ static void Dial_X(benchmark::State &state) {
auto &result = g.dial(*(range_start->second->getNodePair().first), 1);
}
}
BENCHMARK(Dial_X)->RangeMultiplier(16)->Range((unsigned long)1,
(unsigned long)1 << 16);
BENCHMARK(Dial_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 16)
->Complexity();

static void Dial_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -27,4 +29,4 @@ static void Dial_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(Dial_FromReadedCitHep);
BENCHMARK(Dial_FromReadedCitHep)->Complexity();
5 changes: 3 additions & 2 deletions benchmark/Dijkstra_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ static void Dijkstra_X(benchmark::State &state) {
}
BENCHMARK(Dijkstra_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 16);
->Range((unsigned long)1, (unsigned long)1 << 16)
->Complexity();

static void Dijkstra_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -30,4 +31,4 @@ static void Dijkstra_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(Dijkstra_FromReadedCitHep);
BENCHMARK(Dijkstra_FromReadedCitHep)->Complexity();
8 changes: 4 additions & 4 deletions benchmark/Edge_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ static void BM_EdgeCreation(benchmark::State &state) {
}
}

BENCHMARK(BM_EdgeCreation);
BENCHMARK(BM_EdgeCreation)->Complexity();

static void EdgeCreationDestruction_new_delete(benchmark::State &state) {
auto nodes = generateRandomNodes(2, 2);
Expand All @@ -25,7 +25,7 @@ static void EdgeCreationDestruction_new_delete(benchmark::State &state) {
}
}

BENCHMARK(EdgeCreationDestruction_new_delete);
BENCHMARK(EdgeCreationDestruction_new_delete)->Complexity();

static void EdgeGetId(benchmark::State &state) {
auto nodes = generateRandomNodes(2, 2);
Expand All @@ -36,7 +36,7 @@ static void EdgeGetId(benchmark::State &state) {
e.getId();
}
}
BENCHMARK(EdgeGetId);
BENCHMARK(EdgeGetId)->Complexity();

static void NodeGetNodePair(benchmark::State &state) {
auto nodes = generateRandomNodes(2, 2);
Expand All @@ -47,4 +47,4 @@ static void NodeGetNodePair(benchmark::State &state) {
e.getNodePair();
}
}
BENCHMARK(NodeGetNodePair);
BENCHMARK(NodeGetNodePair)->Complexity();
3 changes: 2 additions & 1 deletion benchmark/EulerPath_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ static void EulerPath_X(benchmark::State &state) {
}
BENCHMARK(EulerPath_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 16);
->Range((unsigned long)1, (unsigned long)1 << 16)
->Complexity();
8 changes: 4 additions & 4 deletions benchmark/FloydWarshall_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static void BM_FWDirected(benchmark::State &state) {
CXXGraph::FWResult res = graph.floydWarshall();
}
}
BENCHMARK(BM_FWDirected);
BENCHMARK(BM_FWDirected)->Complexity();

// a graph with negative cycle
static void BM_FWNegCycle(benchmark::State &state) {
Expand All @@ -51,7 +51,7 @@ static void BM_FWNegCycle(benchmark::State &state) {
CXXGraph::FWResult res = graph.floydWarshall();
}
}
BENCHMARK(BM_FWNegCycle);
BENCHMARK(BM_FWNegCycle)->Complexity();

static void BM_FWUndirectedWeighted(benchmark::State &state) {
CXXGraph::Node<int> node1("1", 1);
Expand All @@ -71,7 +71,7 @@ static void BM_FWUndirectedWeighted(benchmark::State &state) {
CXXGraph::FWResult res = graph.floydWarshall();
}
}
BENCHMARK(BM_FWUndirectedWeighted);
BENCHMARK(BM_FWUndirectedWeighted)->Complexity();

static void BM_FWNoWeighted(benchmark::State &state) {
CXXGraph::Node<int> node1("1", 1);
Expand All @@ -92,4 +92,4 @@ static void BM_FWNoWeighted(benchmark::State &state) {
}
}

BENCHMARK(BM_FWNoWeighted);
BENCHMARK(BM_FWNoWeighted)->Complexity();
5 changes: 3 additions & 2 deletions benchmark/FordFulkerson_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ static void FordFulkerson_X(benchmark::State &state) {
}
BENCHMARK(FordFulkerson_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 16);
->Range((unsigned long)1, (unsigned long)1 << 16)
->Complexity();

static void FordFulkerson_FromReadedCitHep(benchmark::State &state) {
auto edgeSet = cit_graph_ptr->getEdgeSet();
Expand All @@ -31,4 +32,4 @@ static void FordFulkerson_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(FordFulkerson_FromReadedCitHep);
BENCHMARK(FordFulkerson_FromReadedCitHep)->Complexity();
3 changes: 2 additions & 1 deletion benchmark/GraphSlicing_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ static void GraphSlicing_X(benchmark::State &state) {
}
BENCHMARK(GraphSlicing_X)
->RangeMultiplier(16)
->Range((unsigned long)1, (unsigned long)1 << 8);
->Range((unsigned long)1, (unsigned long)1 << 8)
->Complexity();
Loading

0 comments on commit f98b54c

Please sign in to comment.