From 2793bb1d68e8db479b6c9351bdb81070d8ba1055 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 16 Apr 2023 14:55:18 +0100 Subject: [PATCH] Performance. --- pcbnew/ratsnest/ratsnest_data.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pcbnew/ratsnest/ratsnest_data.cpp b/pcbnew/ratsnest/ratsnest_data.cpp index f7035fa452..f9b4796536 100644 --- a/pcbnew/ratsnest/ratsnest_data.cpp +++ b/pcbnew/ratsnest/ratsnest_data.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KICAD, a free EDA CAD application. * * Copyright (C) 2013-2017 CERN - * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors. * * @author Maciej Suminski * @author Tomasz Wlostowski @@ -166,7 +166,7 @@ public: m_allNodes.clear(); } - void AddNode( std::shared_ptr aNode ) + void AddNode( const std::shared_ptr& aNode ) { m_allNodes.insert( aNode ); } @@ -333,7 +333,7 @@ void RN_NET::optimizeRNEdges() auto optimizeZoneAnchor = [&]( const VECTOR2I& aPos, const LSET& aLayerSet, const std::shared_ptr& aAnchor, - std::function )> setOptimizedTo ) + const std::function )>& setOptimizedTo ) { SEG::ecoord closest_dist_sq = ( aAnchor->Pos() - aPos ).SquaredEuclideanNorm(); VECTOR2I closest_pt; @@ -347,7 +347,7 @@ void RN_NET::optimizeRNEdges() { const std::vector& pts = zoneLayer->GetOutline().CPoints(); - for( VECTOR2I pt : pts ) + for( const VECTOR2I& pt : pts ) { SEG::ecoord dist_sq = ( pt - aPos ).SquaredEuclideanNorm(); @@ -368,8 +368,8 @@ void RN_NET::optimizeRNEdges() auto optimizeZoneToZoneAnchors = [&]( const std::shared_ptr& a, const std::shared_ptr& b, - std::function&)> setOptimizedATo, - std::function&)> setOptimizedBTo ) + const std::function&)>& setOptimizedATo, + const std::function&)>& setOptimizedBTo ) { for( CN_ITEM* itemA : a->Item()->ConnectedItems() ) { @@ -415,7 +415,7 @@ void RN_NET::optimizeRNEdges() if( source->ConnectedItemsCount() == 0 ) { optimizeZoneAnchor( source->Pos(), source->Parent()->GetLayerSet(), target, - [&]( std::shared_ptr optimized ) + [&]( const std::shared_ptr& optimized ) { edge.SetTargetNode( optimized ); } ); @@ -423,7 +423,7 @@ void RN_NET::optimizeRNEdges() else if( target->ConnectedItemsCount() == 0 ) { optimizeZoneAnchor( target->Pos(), target->Parent()->GetLayerSet(), source, - [&]( std::shared_ptr optimized ) + [&]( const std::shared_ptr& optimized ) { edge.SetSourceNode( optimized ); } ); @@ -431,11 +431,11 @@ void RN_NET::optimizeRNEdges() else { optimizeZoneToZoneAnchors( source, target, - [&]( std::shared_ptr optimized ) + [&]( const std::shared_ptr& optimized ) { edge.SetSourceNode( optimized ); }, - [&]( std::shared_ptr optimized ) + [&]( const std::shared_ptr& optimized ) { edge.SetTargetNode( optimized ); } );