Performance for large hierarchies: avoid sorting
Don't sort SCH_SHEET_LISTs if we're just scanning the doc.
This commit is contained in:
parent
44c588f122
commit
a6e8cfe35f
|
@ -1367,11 +1367,9 @@ void CONNECTION_GRAPH::buildItemSubGraphs()
|
|||
// Recache all bus aliases for later use
|
||||
wxCHECK_RET( m_schematic, wxS( "Connection graph cannot be built without schematic pointer" ) );
|
||||
|
||||
SCH_SHEET_LIST all_sheets = m_schematic->GetSheets();
|
||||
|
||||
for( unsigned i = 0; i < all_sheets.size(); i++ )
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->GetUnorderedSheets() )
|
||||
{
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : all_sheets[i].LastScreen()->GetBusAliases() )
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : sheet.LastScreen()->GetBusAliases() )
|
||||
m_bus_alias_cache[ alias->GetName() ] = alias;
|
||||
}
|
||||
|
||||
|
@ -2086,11 +2084,9 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
|
|||
// Recache all bus aliases for later use
|
||||
wxCHECK_RET( m_schematic, wxT( "Connection graph cannot be built without schematic pointer" ) );
|
||||
|
||||
SCH_SHEET_LIST all_sheets = m_schematic->GetSheets();
|
||||
|
||||
for( unsigned i = 0; i < all_sheets.size(); i++ )
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->GetUnorderedSheets() )
|
||||
{
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : all_sheets[i].LastScreen()->GetBusAliases() )
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : sheet.LastScreen()->GetBusAliases() )
|
||||
m_bus_alias_cache[ alias->GetName() ] = alias;
|
||||
}
|
||||
|
||||
|
|
|
@ -284,14 +284,12 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
|
|||
|
||||
wxCHECK( frame, /* void */ );
|
||||
|
||||
SCH_SHEET_LIST hierarchy = frame->Schematic().GetSheets();
|
||||
|
||||
// Load non-mandatory fields from all matching symbols and their library symbols
|
||||
std::vector<SCH_FIELD*> fields;
|
||||
std::vector<SCH_FIELD*> libFields;
|
||||
std::set<wxString> fieldNames;
|
||||
|
||||
for( SCH_SHEET_PATH& instance : hierarchy )
|
||||
for( SCH_SHEET_PATH& instance : frame->Schematic().GetUnorderedSheets() )
|
||||
{
|
||||
SCH_SCREEN* screen = instance.LastScreen();
|
||||
|
||||
|
@ -798,7 +796,7 @@ wxString DIALOG_CHANGE_SYMBOLS::getSymbolReferences( SCH_SYMBOL& aSymbol,
|
|||
|
||||
wxCHECK( parent, msg );
|
||||
|
||||
SCH_SHEET_LIST sheets = parent->Schematic().GetSheets();
|
||||
SCH_SHEET_LIST sheets = parent->Schematic().GetUnorderedSheets();
|
||||
|
||||
for( const SCH_SYMBOL_INSTANCE& instance : aSymbol.GetInstances() )
|
||||
{
|
||||
|
|
|
@ -580,7 +580,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
|||
SCH_COMMIT commit( m_parent );
|
||||
|
||||
// Go through sheets
|
||||
for( const SCH_SHEET_PATH& sheetPath : m_parent->Schematic().GetSheets() )
|
||||
for( const SCH_SHEET_PATH& sheetPath : m_parent->Schematic().GetUnorderedSheets() )
|
||||
{
|
||||
SCH_SCREEN* screen = sheetPath.LastScreen();
|
||||
|
||||
|
|
|
@ -290,18 +290,16 @@ void ERC_SETTINGS::ResetPinMap()
|
|||
|
||||
void SHEETLIST_ERC_ITEMS_PROVIDER::visitMarkers( std::function<void( SCH_MARKER* )> aVisitor ) const
|
||||
{
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
|
||||
std::set<SCH_SCREEN*> seenScreens;
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->GetUnorderedSheets() )
|
||||
{
|
||||
bool firstTime = seenScreens.count( sheetList[i].LastScreen() ) == 0;
|
||||
bool firstTime = seenScreens.count( sheet.LastScreen() ) == 0;
|
||||
|
||||
if( firstTime )
|
||||
seenScreens.insert( sheetList[i].LastScreen() );
|
||||
seenScreens.insert( sheet.LastScreen() );
|
||||
|
||||
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_MARKER_T ) )
|
||||
{
|
||||
SCH_MARKER* marker = static_cast<SCH_MARKER*>( item );
|
||||
|
||||
|
@ -314,7 +312,7 @@ void SHEETLIST_ERC_ITEMS_PROVIDER::visitMarkers( std::function<void( SCH_MARKER*
|
|||
// Only show sheet-specific markers on the owning sheet
|
||||
if( ercItem->IsSheetSpecific() )
|
||||
{
|
||||
if( ercItem->GetSpecificSheetPath() != sheetList[i] )
|
||||
if( ercItem->GetSpecificSheetPath() != sheet )
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1074,14 +1074,10 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||
}
|
||||
|
||||
// Attempt to make sheet file name paths relative to the new root schematic path.
|
||||
SCH_SHEET_LIST sheets = Schematic().GetSheets();
|
||||
|
||||
for( SCH_SHEET_PATH& sheet : sheets )
|
||||
for( SCH_SHEET_PATH& sheet : Schematic().GetUnorderedSheets() )
|
||||
{
|
||||
if( sheet.Last()->IsRootSheet() )
|
||||
continue;
|
||||
|
||||
sheet.MakeFilePathRelativeToParentSheet();
|
||||
if( !sheet.Last()->IsRootSheet() )
|
||||
sheet.MakeFilePathRelativeToParentSheet();
|
||||
}
|
||||
}
|
||||
else if( !fn.FileExists() )
|
||||
|
|
|
@ -2627,7 +2627,7 @@ int SCH_EDITOR_CONTROL::RepairSchematic( const TOOL_EVENT& aEvent )
|
|||
// Symbol IDs are the most important, so give them the first crack at "claiming" a
|
||||
// particular KIID.
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : m_frame->Schematic().GetSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : m_frame->Schematic().GetUnorderedSheets() )
|
||||
{
|
||||
SCH_SCREEN* screen = sheet.LastScreen();
|
||||
|
||||
|
@ -2640,7 +2640,7 @@ int SCH_EDITOR_CONTROL::RepairSchematic( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : m_frame->Schematic().GetSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : m_frame->Schematic().GetUnorderedSheets() )
|
||||
{
|
||||
SCH_SCREEN* screen = sheet.LastScreen();
|
||||
|
||||
|
|
Loading…
Reference in New Issue