eeschema connectivity - Adjust performance in init

This allow single init for map structures, improving first-run
performance.
This commit is contained in:
Seth Hillbrand 2019-04-09 21:00:11 -07:00
parent 2048114512
commit 9ef442b3a3
2 changed files with 6 additions and 10 deletions

View File

@ -653,7 +653,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
// We don't want to spin up a new thread for fewer than 8 nets (overhead costs)
size_t parallelThreadCount = std::min<size_t>( std::thread::hardware_concurrency(),
( m_subgraphs.size() + 7 ) / 8 );
( m_subgraphs.size() + 3 ) / 4 );
std::atomic<size_t> nextSubgraph( 0 );
std::vector<std::future<size_t>> returns( parallelThreadCount );

View File

@ -81,7 +81,7 @@ void SCH_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
bool SCH_ITEM::IsConnected( const wxPoint& aPosition ) const
{
if( m_Flags & STRUCT_DELETED || m_Flags & SKIP_STRUCT )
if( ( m_Flags & STRUCT_DELETED ) || ( m_Flags & SKIP_STRUCT ) )
return false;
return doIsConnected( aPosition );
@ -90,18 +90,14 @@ bool SCH_ITEM::IsConnected( const wxPoint& aPosition ) const
SCH_CONNECTION* SCH_ITEM::Connection( const SCH_SHEET_PATH& aSheet ) const
{
SCH_CONNECTION* conn = nullptr;
if( m_connection_map.count( aSheet ) )
try
{
conn = m_connection_map.at( aSheet );
return m_connection_map.at( aSheet );
}
else
catch( ... )
{
// TODO(JE) should we just call InitializeConnection here?
return nullptr;
}
return conn;
}