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
This commit is contained in:
parent
c1dcfdffb1
commit
7aebc4b11f
|
@ -625,8 +625,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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -670,8 +670,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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,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> // for PLOT_DASH_TYPE definition
|
||||
|
@ -131,7 +131,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
typedef std::unordered_set<SCH_ITEM*> SCH_ITEM_SET;
|
||||
typedef std::vector<SCH_ITEM*> SCH_ITEM_SET;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -492,7 +492,7 @@ bool SCH_TEXT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
|
|||
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