Improve pin-pin iteration in ERC checks
Rather than generating expensive classes to store in a set to check for duplicate checks, we avoid double-checking elements in the vector. For large schematics this results in a substantial speed increase
This commit is contained in:
parent
87c8688f70
commit
1a5c515e45
|
@ -619,8 +619,6 @@ int ERC_TESTER::TestPinToPin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<std::pair<ERC_SCH_PIN_CONTEXT, ERC_SCH_PIN_CONTEXT>> tested;
|
|
||||||
|
|
||||||
ERC_SCH_PIN_CONTEXT needsDriver;
|
ERC_SCH_PIN_CONTEXT needsDriver;
|
||||||
bool hasDriver = false;
|
bool hasDriver = false;
|
||||||
|
|
||||||
|
@ -638,8 +636,9 @@ int ERC_TESTER::TestPinToPin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ERC_SCH_PIN_CONTEXT& refPin : pins )
|
for( auto refIt = pins.begin(); refIt != pins.end(); ++refIt )
|
||||||
{
|
{
|
||||||
|
ERC_SCH_PIN_CONTEXT& refPin = *refIt;
|
||||||
ELECTRICAL_PINTYPE refType = refPin.Pin()->GetType();
|
ELECTRICAL_PINTYPE refType = refPin.Pin()->GetType();
|
||||||
|
|
||||||
if( DrivenPinTypes.count( refType ) )
|
if( DrivenPinTypes.count( refType ) )
|
||||||
|
@ -663,22 +662,9 @@ int ERC_TESTER::TestPinToPin()
|
||||||
else
|
else
|
||||||
hasDriver |= ( DrivingPinTypes.count( refType ) != 0 );
|
hasDriver |= ( DrivingPinTypes.count( refType ) != 0 );
|
||||||
|
|
||||||
for( ERC_SCH_PIN_CONTEXT& testPin : pins )
|
for( auto testIt = refIt + 1; testIt != pins.end(); ++testIt )
|
||||||
{
|
{
|
||||||
if( testPin == refPin )
|
ERC_SCH_PIN_CONTEXT& testPin = *testIt;
|
||||||
continue;
|
|
||||||
|
|
||||||
ERC_SCH_PIN_CONTEXT first_pin = refPin;
|
|
||||||
ERC_SCH_PIN_CONTEXT second_pin = testPin;
|
|
||||||
|
|
||||||
if( second_pin < first_pin )
|
|
||||||
std::swap( first_pin, second_pin );
|
|
||||||
|
|
||||||
std::pair<ERC_SCH_PIN_CONTEXT, ERC_SCH_PIN_CONTEXT> pair =
|
|
||||||
std::make_pair( first_pin, second_pin );
|
|
||||||
|
|
||||||
if( auto [ins_pin, inserted ] = tested.insert( pair ); !inserted )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Multiple pins in the same symbol that share a type,
|
// Multiple pins in the same symbol that share a type,
|
||||||
// name and position are considered
|
// name and position are considered
|
||||||
|
|
Loading…
Reference in New Issue