Split ratsnest optimization into separate parallel threads.

Fixes https://gitlab.com/kicad/code/kicad/issues/12968
This commit is contained in:
Jeff Young 2022-11-21 18:50:01 +00:00
parent 3b31955d98
commit 106508f266
3 changed files with 18 additions and 5 deletions

View File

@ -178,7 +178,14 @@ void CONNECTIVITY_DATA::updateRatsnest()
[&]( const int a, const int b)
{
for( int ii = a; ii < b; ++ii )
dirty_nets[ii]->Update();
dirty_nets[ ii ]->UpdateNet();
}).wait();
GetKiCadThreadPool().parallelize_loop( 0, dirty_nets.size(),
[&]( const int a, const int b)
{
for( int ii = a; ii < b; ++ii )
dirty_nets[ii]->OptimizeNet();
}).wait();
#ifdef PROFILE

View File

@ -437,19 +437,24 @@ void RN_NET::optimizeRNEdges()
}
void RN_NET::Update()
void RN_NET::UpdateNet()
{
compute();
m_dirty = false;
}
void RN_NET::OptimizeNet()
{
#ifdef PROFILE
PROF_TIMER cnt( "optimize" );
#endif
optimizeRNEdges();
#ifdef PROFILE
cnt.Show();
#endif
m_dirty = false;
}

View File

@ -80,7 +80,8 @@ public:
/**
* Recompute ratsnest for a net.
*/
void Update();
void UpdateNet();
void OptimizeNet();
void Clear();
void AddCluster( std::shared_ptr<CN_CLUSTER> aCluster );