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
This commit is contained in:
Seth Hillbrand 2019-04-09 23:40:24 -07:00
parent 1c93b122f1
commit e28c937a5c
1 changed files with 7 additions and 3 deletions

View File

@ -950,8 +950,9 @@ void CONNECTION_GRAPH::buildConnectionGraph()
// Generate net codes // 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; auto connection = subgraph->m_driver_connection;
int code; int code;
@ -980,6 +981,9 @@ void CONNECTION_GRAPH::buildConnectionGraph()
{ {
auto item_conn = item->Connection( subgraph->m_sheet ); auto item_conn = item->Connection( subgraph->m_sheet );
if( !item_conn )
item_conn = item->InitializeConnection( subgraph->m_sheet );
if( ( connection->IsBus() && item_conn->IsNet() ) || if( ( connection->IsBus() && item_conn->IsNet() ) ||
( connection->IsNet() && item_conn->IsBus() ) ) ( connection->IsNet() && item_conn->IsBus() ) )
{ {
@ -1041,9 +1045,9 @@ void CONNECTION_GRAPH::buildConnectionGraph()
} }
std::vector<CONNECTION_SUBGRAPH*> candidate_subgraphs; std::vector<CONNECTION_SUBGRAPH*> 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 ) [&] ( CONNECTION_SUBGRAPH* candidate )
{ return ( candidate->m_local_driver && candidate != subgraph && { return ( candidate->m_local_driver &&
candidate->m_sheet == sheet && candidate->m_sheet == sheet &&
candidate->m_driver_connection->IsNet() ); candidate->m_driver_connection->IsNet() );
} ); } );