Restore clearance cache usage in PNS::NODE::NearestObstacle.

This (and the other commit) restores router performance to pre-7.0.3 levels.
This commit is contained in:
Alex Shvartzkop 2023-11-07 01:20:25 +03:00
parent d29c07a663
commit 5e93814283
1 changed files with 6 additions and 10 deletions

View File

@ -281,21 +281,17 @@ int NODE::QueryColliding( const ITEM* aItem, NODE::OBSTACLES& aObstacles,
NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine,
const COLLISION_SEARCH_OPTIONS& aOpts )
{
const int clearanceEpsilon = GetRuleResolver()->ClearanceEpsilon();
OBSTACLES obstacleList;
std::vector<SEGMENT> tmpSegs;
tmpSegs.reserve( aLine->CLine().SegmentCount() );
const int clearanceEpsilon = GetRuleResolver()->ClearanceEpsilon();
OBSTACLES obstacleList;
for( int i = 0; i < aLine->CLine().SegmentCount(); i++ )
{
// Note: Clearances between tmpSegs.back() and other items are cached,
// Note: Clearances between &s and other items are cached,
// which means they'll be the same for all segments in the line.
// Disabling the cache will lead to slowness.
tmpSegs.emplace_back( *aLine, aLine->CLine().CSegment( i ) );
QueryColliding( &tmpSegs.back(), obstacleList, aOpts );
const SEGMENT s( *aLine, aLine->CLine().CSegment( i ) );
QueryColliding( &s, obstacleList, aOpts );
}
if( aLine->EndsWithVia() )
@ -703,7 +699,7 @@ void NODE::doRemove( ITEM* aItem )
if( aItem->BelongsTo( m_root ) && !isRoot() )
{
m_override.insert( aItem );
if( aItem->HasHole() )
m_override.insert( aItem->Hole() );
}