Move connected_items from hash table to tree
This gains about 10% speed in heavily connected sheets
Fixes https://gitlab.com/kicad/code/kicad/issues/10974
(cherry picked from commit 187aa1c171
)
This commit is contained in:
parent
5b5c7d41b4
commit
d653484d72
|
@ -378,6 +378,9 @@ void CONNECTION_SUBGRAPH::UpdateItemConnections()
|
||||||
{
|
{
|
||||||
SCH_CONNECTION* item_conn = item->GetOrInitConnection( m_sheet, m_graph );
|
SCH_CONNECTION* item_conn = item->GetOrInitConnection( m_sheet, m_graph );
|
||||||
|
|
||||||
|
if( !item_conn )
|
||||||
|
continue;
|
||||||
|
|
||||||
if( ( m_driver_connection->IsBus() && item_conn->IsNet() ) ||
|
if( ( m_driver_connection->IsBus() && item_conn->IsNet() ) ||
|
||||||
( m_driver_connection->IsNet() && item_conn->IsBus() ) )
|
( m_driver_connection->IsNet() && item_conn->IsBus() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#define SCH_ITEM_H
|
#define SCH_ITEM_H
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include <eda_item.h>
|
#include <eda_item.h>
|
||||||
|
@ -481,7 +482,7 @@ protected:
|
||||||
// to store a initial pos of the item or mouse cursor
|
// to store a initial pos of the item or mouse cursor
|
||||||
|
|
||||||
/// Store pointers to other items that are connected to this one, per sheet.
|
/// Store pointers to other items that are connected to this one, per sheet.
|
||||||
std::unordered_map<SCH_SHEET_PATH, SCH_ITEM_SET> m_connected_items;
|
std::map<SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMP> m_connected_items;
|
||||||
|
|
||||||
/// Store connectivity information, per sheet.
|
/// Store connectivity information, per sheet.
|
||||||
std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> m_connection_map;
|
std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> m_connection_map;
|
||||||
|
|
|
@ -393,6 +393,14 @@ namespace std
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct SHEET_PATH_CMP
|
||||||
|
{
|
||||||
|
bool operator()( const SCH_SHEET_PATH& lhs, const SCH_SHEET_PATH& rhs ) const
|
||||||
|
{
|
||||||
|
return lhs.GetCurrentHash() < rhs.GetCurrentHash();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef std::vector< SCH_SHEET_PATH > SCH_SHEET_PATHS;
|
typedef std::vector< SCH_SHEET_PATH > SCH_SHEET_PATHS;
|
||||||
typedef SCH_SHEET_PATHS::iterator SCH_SHEET_PATHS_ITER;
|
typedef SCH_SHEET_PATHS::iterator SCH_SHEET_PATHS_ITER;
|
||||||
|
|
Loading…
Reference in New Issue