From e28c937a5c51d6bf9d24ec9370e2127cd10432fb Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 9 Apr 2019 23:40:24 -0700 Subject: [PATCH] Limit number of subgraph checks Candidate subgraphs only need to be checked once, so start the iteration from the next element in the driver vector --- eeschema/connection_graph.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 3e40ad7f7e..82234d164a 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -950,8 +950,9 @@ void CONNECTION_GRAPH::buildConnectionGraph() // Generate net codes - for( auto subgraph : driver_subgraphs ) + for( auto subgraph_it = driver_subgraphs.begin(); subgraph_it != driver_subgraphs.end(); subgraph_it++ ) { + auto subgraph = *subgraph_it; auto connection = subgraph->m_driver_connection; int code; @@ -980,6 +981,9 @@ void CONNECTION_GRAPH::buildConnectionGraph() { auto item_conn = item->Connection( subgraph->m_sheet ); + if( !item_conn ) + item_conn = item->InitializeConnection( subgraph->m_sheet ); + if( ( connection->IsBus() && item_conn->IsNet() ) || ( connection->IsNet() && item_conn->IsBus() ) ) { @@ -1041,9 +1045,9 @@ void CONNECTION_GRAPH::buildConnectionGraph() } std::vector candidate_subgraphs; - std::copy_if( driver_subgraphs.begin(), driver_subgraphs.end(), std::back_inserter( candidate_subgraphs ), + std::copy_if( subgraph_it + 1, driver_subgraphs.end(), std::back_inserter( candidate_subgraphs ), [&] ( CONNECTION_SUBGRAPH* candidate ) - { return ( candidate->m_local_driver && candidate != subgraph && + { return ( candidate->m_local_driver && candidate->m_sheet == sheet && candidate->m_driver_connection->IsNet() ); } );