Change connectivity item group from set to vector
Reserve space for new items to speed construction of connectivity graph
Fixes https://gitlab.com/kicad/code/kicad/issues/10974
(cherry picked from commit 7aebc4b11f
)
This commit is contained in:
parent
69453964b4
commit
8fd87e1f04
|
@ -637,8 +637,8 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
|
|||
else
|
||||
bus_entry->m_connected_bus_items[1] = busLine;
|
||||
|
||||
bus_entry->ConnectedItems( aSheet ).insert( busLine );
|
||||
busLine->ConnectedItems( aSheet ).insert( bus_entry );
|
||||
bus_entry->AddConnectionTo( aSheet, busLine );
|
||||
busLine->AddConnectionTo( aSheet, bus_entry );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -682,8 +682,8 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
|
|||
test_item->ConnectionPropagatesTo( connected_item ) &&
|
||||
bus_connection_ok )
|
||||
{
|
||||
connected_item->ConnectedItems( aSheet ).insert( test_item );
|
||||
test_item->ConnectedItems( aSheet ).insert( connected_item );
|
||||
connected_item->AddConnectionTo( aSheet, test_item );
|
||||
test_item->AddConnectionTo( aSheet, connected_item );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,11 @@ SCH_ITEM_SET& SCH_ITEM::ConnectedItems( const SCH_SHEET_PATH& aSheet )
|
|||
|
||||
void SCH_ITEM::AddConnectionTo( const SCH_SHEET_PATH& aSheet, SCH_ITEM* aItem )
|
||||
{
|
||||
m_connected_items[ aSheet ].insert( aItem );
|
||||
// The vector elements are small, so reserve 1k at a time to prevent re-allocations
|
||||
if( m_connected_items[ aSheet ].capacity() == 0 )
|
||||
m_connected_items[ aSheet ].reserve( 1024 );
|
||||
|
||||
m_connected_items[ aSheet ].emplace_back( aItem );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#define SCH_ITEM_H
|
||||
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <set>
|
||||
|
||||
#include <eda_item.h>
|
||||
#include <plotters/plotter.h>
|
||||
|
@ -130,7 +130,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
typedef std::unordered_set<SCH_ITEM*> SCH_ITEM_SET;
|
||||
typedef std::vector<SCH_ITEM*> SCH_ITEM_SET;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -690,7 +690,7 @@ bool SCH_LABEL_BASE::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemL
|
|||
m_isDangling = false;
|
||||
|
||||
if( aPath && item.GetType() != PIN_END )
|
||||
m_connected_items[ *aPath ].insert( static_cast<SCH_ITEM*>( item.GetItem() ) );
|
||||
AddConnectionTo( *aPath, static_cast<SCH_ITEM*>( item.GetItem() ) );
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue