Skip to content

Commit 27a26ed

Browse files
authored
Optimize vector copying (#537)
1 parent a844bdc commit 27a26ed

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

include/CXXGraph/Partitioning/CoordinatedPartitionState.hpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,7 @@ int CoordinatedPartitionState<T>::getMachineWithMinWeight(
212212
template <typename T>
213213
std::vector<int> CoordinatedPartitionState<T>::getMachines_load() const {
214214
std::lock_guard<std::mutex> lock(*machines_load_edges_mutex);
215-
std::vector<int> result;
216-
for (const auto &machines_load_edges_it : machines_load_edges) {
217-
result.push_back(machines_load_edges_it);
218-
}
219-
return result;
215+
return machines_load_edges;
220216
}
221217
template <typename T>
222218
size_t CoordinatedPartitionState<T>::getTotalReplicas() const {
@@ -257,11 +253,7 @@ template <typename T>
257253
std::vector<int> CoordinatedPartitionState<T>::getMachines_loadVertices()
258254
const {
259255
std::lock_guard<std::mutex> lock(*machines_load_vertices_mutex);
260-
std::vector<int> result;
261-
for (const auto &machines_load_vertices_it : machines_load_vertices) {
262-
result.push_back(machines_load_vertices_it);
263-
}
264-
return result;
256+
return machines_load_vertices;
265257
}
266258

267259
template <typename T>

0 commit comments

Comments
 (0)