From 0ecd5d86bced60db965736b5d7fac14ba2759084 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 6 Jun 2025 10:35:03 +0100 Subject: [PATCH] Performance optimizations. (cherry picked from commit 31c6c28882d519df10ee2a3a08aaa24c840a6b41) --- common/string_utils.cpp | 4 +--- eeschema/sim/kibis/kibis.cpp | 24 ++++++++++----------- libs/kimath/src/geometry/shape_poly_set.cpp | 2 +- pcbnew/router/pns_walkaround.cpp | 2 +- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/common/string_utils.cpp b/common/string_utils.cpp index 2025e72144..a95ec6f792 100644 --- a/common/string_utils.cpp +++ b/common/string_utils.cpp @@ -569,8 +569,6 @@ wxString EscapeHTML( const wxString& aString ) wxString UnescapeHTML( const wxString& aString ) { - wxString converted = aString; - // clang-format off static const std::map c_replacements = { { wxS( "quot" ), wxS( "\"" ) }, @@ -596,7 +594,7 @@ wxString UnescapeHTML( const wxString& aString ) size_t len = 0; wxString result; - wxString str = converted; + wxString str = aString; while( regex.Matches( str ) ) { diff --git a/eeschema/sim/kibis/kibis.cpp b/eeschema/sim/kibis/kibis.cpp index c2e919137d..b75524d4f9 100644 --- a/eeschema/sim/kibis/kibis.cpp +++ b/eeschema/sim/kibis/kibis.cpp @@ -717,9 +717,9 @@ void KIBIS_PIN::getKuKdFromFile( const std::string& aSimul ) Report( _( "Cannot remove temporary output file" ), RPT_SEVERITY_WARNING ); } - m_Ku = ku; - m_Kd = kd; - m_t = t; + m_Ku = std::move( ku ); + m_Kd = std::move( kd ); + m_t = std::move( t ); } @@ -818,9 +818,9 @@ void KIBIS_PIN::getKuKdOneWaveform( KIBIS_MODEL& ku.push_back( 0 ); kd.push_back( 0 ); t.push_back( 0 ); - m_Ku = ku; - m_Kd = kd; - m_t = t; + m_Ku = std::move( ku ); + m_Kd = std::move( kd ); + m_t = std::move( t ); } else { @@ -965,9 +965,9 @@ void KIBIS_PIN::getKuKdNoWaveform( KIBIS_MODEL& aModel, const KIBIS_PARAMETER& a t.push_back( 0 ); } - m_Ku = ku; - m_Kd = kd; - m_t = t; + m_Ku = std::move( ku ); + m_Kd = std::move( kd ); + m_t = std::move( t ); } @@ -990,9 +990,9 @@ void KIBIS_PIN::getKuKdTwoWaveforms( KIBIS_MODEL& ku.push_back( 0 ); kd.push_back( 0 ); t.push_back( 0 ); - m_Ku = ku; - m_Kd = kd; - m_t = t; + m_Ku = std::move( ku ); + m_Kd = std::move( kd ); + m_t = std::move( t ); } else { diff --git a/libs/kimath/src/geometry/shape_poly_set.cpp b/libs/kimath/src/geometry/shape_poly_set.cpp index 2cc202f31f..68fc69a4c1 100644 --- a/libs/kimath/src/geometry/shape_poly_set.cpp +++ b/libs/kimath/src/geometry/shape_poly_set.cpp @@ -1999,7 +1999,7 @@ bool SHAPE_POLY_SET::Parse( std::stringstream& aStream ) paths.push_back( outline ); } - m_polys.push_back( paths ); + m_polys.push_back( std::move( paths ) ); } return true; diff --git a/pcbnew/router/pns_walkaround.cpp b/pcbnew/router/pns_walkaround.cpp index ab06ec779f..b164e6aba8 100644 --- a/pcbnew/router/pns_walkaround.cpp +++ b/pcbnew/router/pns_walkaround.cpp @@ -257,7 +257,7 @@ bool WALKAROUND::singleStep() if ( anyColliding ) { - shortest = shortest_alt; + shortest = std::move( shortest_alt ); } if( !shortest )