From fb2611632d7c17bd5a1b9178e75178424571e815 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 17 Dec 2019 21:16:29 +0100 Subject: [PATCH] Some performance improvement of net extractor. --- src/db/db/dbHierNetworkProcessor.cc | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/db/db/dbHierNetworkProcessor.cc b/src/db/db/dbHierNetworkProcessor.cc index c19f12dc1..8f5f74fda 100644 --- a/src/db/db/dbHierNetworkProcessor.cc +++ b/src/db/db/dbHierNetworkProcessor.cc @@ -1023,15 +1023,21 @@ connected_clusters::join_cluster_with (typename local_cluster::id_type id, // handle the connections by translating - const connections_type &to_join = connections_for_cluster (with_id); - connections_type &target = m_connections [id]; - target.insert (target.end (), to_join.begin (), to_join.end ()); + typename std::map::id_type, connections_type>::iterator tc = m_connections.find (with_id); + if (tc != m_connections.end ()) { + + connections_type &to_join = tc->second; + + for (connections_type::const_iterator c = to_join.begin (); c != to_join.end (); ++c) { + m_rev_connections [*c] = id; + } + + connections_type &target = m_connections [id]; + target.splice (target.end (), to_join, to_join.begin (), to_join.end ()); + + m_connections.erase (tc); - for (connections_type::const_iterator c = to_join.begin (); c != to_join.end (); ++c) { - m_rev_connections [*c] = id; } - - m_connections.erase (with_id); } template @@ -1773,11 +1779,8 @@ private: const ClusterInstance &k2 = ic->second; // Note: "with_self" is false as we're going to create a connected cluster anyway - mp_tree->propagate_cluster_inst (*mp_layout, *mp_cell, k1, mp_cell->cell_index (), false); - mp_tree->propagate_cluster_inst (*mp_layout, *mp_cell, k2, mp_cell->cell_index (), false); - - id_type x1 = mp_cell_clusters->find_cluster_with_connection (k1); - id_type x2 = mp_cell_clusters->find_cluster_with_connection (k2); + id_type x1 = mp_tree->propagate_cluster_inst (*mp_layout, *mp_cell, k1, mp_cell->cell_index (), false); + id_type x2 = mp_tree->propagate_cluster_inst (*mp_layout, *mp_cell, k2, mp_cell->cell_index (), false); if (x1 == 0) { @@ -2228,9 +2231,8 @@ hier_clusters::build_hier_connections (cell_clusters_box_converter &cbc, c } else { // ensures the cluster is propagated so we can connect it with another - propagate_cluster_inst (layout, cell, *i, cell.cell_index (), false); + size_t other_id = propagate_cluster_inst (layout, cell, *i, cell.cell_index (), false); - size_t other_id = local.find_cluster_with_connection (*i); if (other_id == gcid) { // shouldn't happen, but duplicate instances may trigger this } else if (other_id) {