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

This (and the other commit) restores router performance to pre-7.0.3 levels.

(cherry-picked from commit 5e93814283)
This commit is contained in:
Alex Shvartzkop 2023-11-07 01:20:25 +03:00
parent 55c44966d9
commit 7abe2e3ea0
1 changed files with 3 additions and 7 deletions

View File

@ -286,19 +286,15 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine,
DIRECTION_45::CORNER_MODE cornerMode = ROUTER::GetInstance()->Settings().GetCornerMode(); DIRECTION_45::CORNER_MODE cornerMode = ROUTER::GetInstance()->Settings().GetCornerMode();
const int clearanceEpsilon = GetRuleResolver()->ClearanceEpsilon(); const int clearanceEpsilon = GetRuleResolver()->ClearanceEpsilon();
OBSTACLES obstacleList; OBSTACLES obstacleList;
std::vector<SEGMENT> tmpSegs;
tmpSegs.reserve( aLine->CLine().SegmentCount() );
for( int i = 0; i < aLine->CLine().SegmentCount(); i++ ) 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. // which means they'll be the same for all segments in the line.
// Disabling the cache will lead to slowness. // Disabling the cache will lead to slowness.
tmpSegs.emplace_back( *aLine, aLine->CLine().CSegment( i ) ); const SEGMENT s( *aLine, aLine->CLine().CSegment( i ) );
QueryColliding( &tmpSegs.back(), obstacleList, aOpts ); QueryColliding( &s, obstacleList, aOpts );
} }
if( aLine->EndsWithVia() ) if( aLine->EndsWithVia() )