Minor performance optimizations.

This commit is contained in:
Jeff Young 2025-06-02 15:27:07 +01:00
parent c2591977b8
commit 96fa79cef2
11 changed files with 26 additions and 30 deletions

View File

@ -320,7 +320,7 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
m_params.emplace_back( new PARAM_LIST<COLOR4D>( "render.raytrace_lightColor", m_params.emplace_back( new PARAM_LIST<COLOR4D>( "render.raytrace_lightColor",
&m_Render.raytrace_lightColor, &m_Render.raytrace_lightColor,
default_colors ) ); std::move( default_colors ) ) );
const std::vector<int> default_elevation = const std::vector<int> default_elevation =
{ {

View File

@ -292,7 +292,7 @@ std::pair<std::set<wxString>,std::set<wxString>> KIGIT_COMMON::GetDifferentFiles
{ {
std::set<wxString>* modified_set_internal = static_cast<std::set<wxString>*>( payload ); std::set<wxString>* modified_set_internal = static_cast<std::set<wxString>*>( payload );
wxString filePath = wxString::Format( "%s%s", root, git_tree_entry_name( entry ) ); wxString filePath = wxString::Format( "%s%s", root, git_tree_entry_name( entry ) );
modified_set_internal->insert( filePath ); modified_set_internal->insert( std::move( filePath ) );
return 0; // continue walking return 0; // continue walking
}, },
&modified_set ); &modified_set );

View File

@ -159,7 +159,7 @@ void POLYGON_GEOM_MANAGER::Reset()
} }
static SHAPE_LINE_CHAIN build45DegLeader( const VECTOR2I& aEndPoint, SHAPE_LINE_CHAIN aLastPoints ) static SHAPE_LINE_CHAIN build45DegLeader( const VECTOR2I& aEndPoint, const SHAPE_LINE_CHAIN& aLastPoints )
{ {
if( aLastPoints.PointCount() < 1 ) if( aLastPoints.PointCount() < 1 )
return SHAPE_LINE_CHAIN(); return SHAPE_LINE_CHAIN();

View File

@ -1301,7 +1301,7 @@ public:
VECTOR_INSERT_TRAVERSER( std::vector<wxString>& aVec, VECTOR_INSERT_TRAVERSER( std::vector<wxString>& aVec,
std::function<bool( const wxString& )> aCond ) : std::function<bool( const wxString& )> aCond ) :
m_files( aVec ), m_files( aVec ),
m_condition( aCond ) m_condition( std::move( aCond ) )
{ {
} }

View File

@ -1311,7 +1311,7 @@ bool ReplaceIllegalFileNameChars( std::string* aName, int aReplaceChar )
} }
if( changed ) if( changed )
*aName = result; *aName = std::move( result );
return changed; return changed;
} }

View File

@ -29,9 +29,7 @@
*/ */
class CVPCB_ASSOCIATION class CVPCB_ASSOCIATION
{ {
public: public:
/** /**
* Create an association event that contains all the information needed to modify the footprint * Create an association event that contains all the information needed to modify the footprint
* association of a component in cvpcb. * association of a component in cvpcb.
@ -40,15 +38,15 @@ public:
* @param aNewFootprint is the new footprint to give to the component * @param aNewFootprint is the new footprint to give to the component
* @param aOldFootprint is the old footprint from the component * @param aOldFootprint is the old footprint from the component
*/ */
CVPCB_ASSOCIATION( CVPCB_ASSOCIATION( unsigned int aComponentIndex, const LIB_ID& aNewFootprint,
unsigned int aComponentIndex, LIB_ID aNewFootprint, LIB_ID aOldFootprint = LIB_ID() ) : const LIB_ID& aOldFootprint = LIB_ID() ) :
m_componentIndex( aComponentIndex ), m_componentIndex( aComponentIndex ),
m_newFootprint( aNewFootprint ), m_newFootprint( aNewFootprint ),
m_oldFootprint( aOldFootprint ) m_oldFootprint( aOldFootprint )
{} {}
CVPCB_ASSOCIATION( CVPCB_ASSOCIATION( unsigned int aComponentIndex, const wxString& aNewFootprint,
unsigned int aComponentIndex, wxString aNewFootprint, wxString aOldFootprint = "" ) : const wxString& aOldFootprint = "" ) :
m_componentIndex( aComponentIndex ) m_componentIndex( aComponentIndex )
{ {
m_newFootprint.Parse( aNewFootprint ); m_newFootprint.Parse( aNewFootprint );
@ -115,12 +113,10 @@ public:
m_oldFootprint = aOldFootprint; m_oldFootprint = aOldFootprint;
} }
private: private:
unsigned int m_componentIndex; unsigned int m_componentIndex;
LIB_ID m_newFootprint; LIB_ID m_newFootprint;
LIB_ID m_oldFootprint; LIB_ID m_oldFootprint;
}; };

View File

@ -255,14 +255,14 @@ public:
void SetDeferredEval( std::function<double()> aLambda ) void SetDeferredEval( std::function<double()> aLambda )
{ {
m_type = VT_NUMERIC; m_type = VT_NUMERIC;
m_lambdaDbl = aLambda; m_lambdaDbl = std::move( aLambda );
m_isDeferredDbl = true; m_isDeferredDbl = true;
} }
void SetDeferredEval( std::function<wxString()> aLambda ) void SetDeferredEval( std::function<wxString()> aLambda )
{ {
m_type = VT_STRING; m_type = VT_STRING;
m_lambdaStr = aLambda; m_lambdaStr = std::move( aLambda );
m_isDeferredStr = true; m_isDeferredStr = true;
} }

View File

@ -92,24 +92,24 @@ template<typename ValueType>
class PARAM : public PARAM_BASE class PARAM : public PARAM_BASE
{ {
public: public:
PARAM( const std::string& aJsonPath, ValueType* aPtr, ValueType aDefault, PARAM( const std::string& aJsonPath, ValueType* aPtr, const ValueType& aDefault,
bool aReadOnly = false ) : bool aReadOnly = false ) :
PARAM_BASE( aJsonPath, aReadOnly ), PARAM_BASE( aJsonPath, aReadOnly ),
m_min(), m_min(),
m_max(), m_max(),
m_use_minmax( false ), m_use_minmax( false ),
m_ptr( aPtr ), m_ptr( aPtr ),
m_default( std::move( aDefault ) ) m_default( aDefault )
{ } { }
PARAM( const std::string& aJsonPath, ValueType* aPtr, ValueType aDefault, ValueType aMin, PARAM( const std::string& aJsonPath, ValueType* aPtr, const ValueType& aDefault,
ValueType aMax, bool aReadOnly = false ) : const ValueType& aMin, const ValueType& aMax, bool aReadOnly = false ) :
PARAM_BASE( aJsonPath, aReadOnly ), PARAM_BASE( aJsonPath, aReadOnly ),
m_min( std::move( aMin ) ), m_min( aMin ),
m_max( std::move( aMax ) ), m_max( aMax ),
m_use_minmax( true ), m_use_minmax( true ),
m_ptr( aPtr ), m_ptr( aPtr ),
m_default( std::move( aDefault ) ) m_default( aDefault )
{ } { }
void Load( const JSON_SETTINGS& aSettings, bool aResetIfMissing = true ) const override void Load( const JSON_SETTINGS& aSettings, bool aResetIfMissing = true ) const override

View File

@ -373,8 +373,8 @@ bool DRC_TEST_PROVIDER::isInvisibleText( const BOARD_ITEM* aItem ) const
} }
wxString DRC_TEST_PROVIDER::formatMsg( const wxString& aFormatString, const wxString& aSource, double aConstraint, wxString DRC_TEST_PROVIDER::formatMsg( const wxString& aFormatString, const wxString& aSource,
double aActual, EDA_DATA_TYPE aType ) double aConstraint, double aActual, EDA_DATA_TYPE aType )
{ {
wxString constraint_str = MessageTextFromValue( aConstraint, true, aType ); wxString constraint_str = MessageTextFromValue( aConstraint, true, aType );
wxString actual_str = MessageTextFromValue( aActual, true, aType ); wxString actual_str = MessageTextFromValue( aActual, true, aType );
@ -386,7 +386,7 @@ wxString DRC_TEST_PROVIDER::formatMsg( const wxString& aFormatString, const wxSt
actual_str = StringFromValue( aActual, true, aType ); actual_str = StringFromValue( aActual, true, aType );
} }
return wxString::Format( aFormatString, aSource, constraint_str, actual_str ); return wxString::Format( aFormatString, aSource, std::move( constraint_str ), std::move( actual_str ) );
} }
wxString DRC_TEST_PROVIDER::formatMsg( const wxString& aFormatString, const wxString& aSource, wxString DRC_TEST_PROVIDER::formatMsg( const wxString& aFormatString, const wxString& aSource,
@ -402,5 +402,5 @@ wxString DRC_TEST_PROVIDER::formatMsg( const wxString& aFormatString, const wxSt
actual_str = StringFromValue( aActual, true ); actual_str = StringFromValue( aActual, true );
} }
return wxString::Format( aFormatString, aSource, constraint_str, actual_str ); return wxString::Format( aFormatString, aSource, std::move( constraint_str ), std::move( actual_str ) );
} }

View File

@ -515,13 +515,13 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
case DIFF_PAIR_GAP_CONSTRAINT: case DIFF_PAIR_GAP_CONSTRAINT:
key.gapConstraint = constraint.GetValue(); key.gapConstraint = constraint.GetValue();
key.gapRule = parentRule; key.gapRule = parentRule;
key.gapRuleName = ruleName; key.gapRuleName = std::move( ruleName );
break; break;
case MAX_UNCOUPLED_CONSTRAINT: case MAX_UNCOUPLED_CONSTRAINT:
key.uncoupledConstraint = constraint.GetValue(); key.uncoupledConstraint = constraint.GetValue();
key.uncoupledRule = parentRule; key.uncoupledRule = parentRule;
key.uncoupledRuleName = ruleName; key.uncoupledRuleName = std::move( ruleName );
break; break;
default: default:

View File

@ -415,7 +415,7 @@ void KICAD_NETLIST_PARSER::parseComponent()
} }
if( !propName.IsEmpty() ) if( !propName.IsEmpty() )
properties[ propName ] = propValue; properties[propName] = std::move( propValue );
} }
break; break;
@ -448,7 +448,7 @@ void KICAD_NETLIST_PARSER::parseComponent()
} }
if( !fieldName.IsEmpty() ) if( !fieldName.IsEmpty() )
fields[fieldName] = fieldValue; fields[fieldName] = std::move( fieldValue );
} }
else else
{ {