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

@ -283,19 +283,15 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine,
{
const int clearanceEpsilon = GetRuleResolver()->ClearanceEpsilon();
OBSTACLES obstacleList;
std::vector<SEGMENT> tmpSegs;
tmpSegs.reserve( aLine->CLine().SegmentCount() );
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() )