From 0abdb0047dafa763a32d0c2942edba9a8893abac Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Wed, 8 Feb 2023 17:07:32 +0100 Subject: [PATCH] :zap: Improved performance by switching to phmap in more places --- .../algorithms/graph/generate_edge_intersection_graph.hpp | 6 +++--- .../fiction/algorithms/path_finding/enumerate_all_paths.hpp | 4 ++-- .../fiction/algorithms/path_finding/k_shortest_paths.hpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/fiction/algorithms/graph/generate_edge_intersection_graph.hpp b/include/fiction/algorithms/graph/generate_edge_intersection_graph.hpp index 1e0dcda62..759c50705 100644 --- a/include/fiction/algorithms/graph/generate_edge_intersection_graph.hpp +++ b/include/fiction/algorithms/graph/generate_edge_intersection_graph.hpp @@ -13,11 +13,11 @@ #include "fiction/utils/stl_utils.hpp" #include +#include #include #include #include -#include #include #include @@ -246,9 +246,9 @@ class generate_edge_intersection_graph_impl private: /** - * Uniquely identify path elements in a set and make them searchable fast. + * Uniquely identify path elements in a set to make them searchable in O(1). */ - std::unordered_set> path_elements{}; + phmap::flat_hash_set> path_elements{}; }; /** * Alias for the path type. diff --git a/include/fiction/algorithms/path_finding/enumerate_all_paths.hpp b/include/fiction/algorithms/path_finding/enumerate_all_paths.hpp index 5ea44fbb8..3fa9b62fe 100644 --- a/include/fiction/algorithms/path_finding/enumerate_all_paths.hpp +++ b/include/fiction/algorithms/path_finding/enumerate_all_paths.hpp @@ -8,7 +8,7 @@ #include "fiction/traits.hpp" #include "fiction/utils/routing_utils.hpp" -#include +#include namespace fiction { @@ -58,7 +58,7 @@ class enumerate_all_clocking_paths_impl enumerate_all_clocking_paths_params ps; - std::unordered_set> visited{}; + phmap::flat_hash_set> visited{}; path_collection collection{}; diff --git a/include/fiction/algorithms/path_finding/k_shortest_paths.hpp b/include/fiction/algorithms/path_finding/k_shortest_paths.hpp index 6f44b8eef..a7b62c49e 100644 --- a/include/fiction/algorithms/path_finding/k_shortest_paths.hpp +++ b/include/fiction/algorithms/path_finding/k_shortest_paths.hpp @@ -102,7 +102,7 @@ class yen_k_shortest_paths_impl } // find an alternative path from the spur coordinate to the target and check that it is not empty - if (auto spur_path = + if (const auto spur_path = a_star(layout, {spur, objective.target}, manhattan_distance_functor, uint64_t>(), unit_cost_functor, uint8_t>(), ps.astar_params);