Handle connection vector inline
Normally, you will gain by resursing a nested loop only over the pairs that are not already handled. In this case, however, you lose time because you step outside of the cache by adding the reciprocal test at each step. Instead, we process one element at a time, keeping it cached and loop over all other elements to add to the connection. This saves us about 75% of the time for larger loops (e.g. stacked power pins on a large BGA) Fixes https://gitlab.com/kicad/code/kicad/issues/10974
This commit is contained in:
parent
a8004cb161
commit
3a98eacdb9
|
@ -640,12 +640,15 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
|
||||||
connected_item->SetLayer( busLine ? LAYER_BUS_JUNCTION : LAYER_JUNCTION );
|
connected_item->SetLayer( busLine ? LAYER_BUS_JUNCTION : LAYER_JUNCTION );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto test_it = primary_it + 1; test_it != connection_vec.end(); test_it++ )
|
SCH_ITEM_SET& connected_set = connected_item->ConnectedItems( aSheet );
|
||||||
|
connected_set.reserve( connection_vec.size() );
|
||||||
|
|
||||||
|
for( SCH_ITEM* test_item : connection_vec )
|
||||||
{
|
{
|
||||||
bool bus_connection_ok = true;
|
bool bus_connection_ok = true;
|
||||||
SCH_ITEM* test_item = *test_it;
|
|
||||||
|
|
||||||
wxASSERT( test_item != connected_item );
|
if( test_item == connected_item )
|
||||||
|
continue;
|
||||||
|
|
||||||
// Set up the link between the bus entry net and the bus
|
// Set up the link between the bus entry net and the bus
|
||||||
if( connected_item->Type() == SCH_BUS_WIRE_ENTRY_T )
|
if( connected_item->Type() == SCH_BUS_WIRE_ENTRY_T )
|
||||||
|
@ -673,8 +676,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
|
||||||
test_item->ConnectionPropagatesTo( connected_item ) &&
|
test_item->ConnectionPropagatesTo( connected_item ) &&
|
||||||
bus_connection_ok )
|
bus_connection_ok )
|
||||||
{
|
{
|
||||||
connected_item->AddConnectionTo( aSheet, test_item );
|
connected_set.push_back( test_item );
|
||||||
test_item->AddConnectionTo( aSheet, connected_item );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue