From 502da2d03c97d2e5e0bb3979144c916cd80aff93 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 21 May 2023 11:23:56 +0100 Subject: [PATCH] Performance improvements. --- eeschema/sim/sim_model_source.cpp | 60 +++++++++++++++---------------- eeschema/sim/sim_model_source.h | 50 ++++++++++++++++---------- pcbnew/plugins/kicad/pcb_parser.h | 2 +- pcbnew/plugins/kicad/pcb_plugin.h | 2 +- 4 files changed, 64 insertions(+), 50 deletions(-) diff --git a/eeschema/sim/sim_model_source.cpp b/eeschema/sim/sim_model_source.cpp index e713602fe3..c14ca16db8 100644 --- a/eeschema/sim/sim_model_source.cpp +++ b/eeschema/sim/sim_model_source.cpp @@ -399,8 +399,8 @@ const std::vector& SIM_MODEL_SOURCE::makeParamInfos( TYP } -std::vector SIM_MODEL_SOURCE::makeDcParamInfos( std::string aPrefix, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makeDcParamInfos( const std::string& aPrefix, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -418,8 +418,8 @@ std::vector SIM_MODEL_SOURCE::makeDcParamInfos( std::str } -std::vector SIM_MODEL_SOURCE::makeSinParamInfos( std::string aPrefix, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makeSinParamInfos( const std::string& aPrefix, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -477,8 +477,8 @@ std::vector SIM_MODEL_SOURCE::makeSinParamInfos( std::st } -std::vector SIM_MODEL_SOURCE::makePulseParamInfos( std::string aPrefix, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makePulseParamInfos( const std::string& aPrefix, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -552,8 +552,8 @@ std::vector SIM_MODEL_SOURCE::makePulseParamInfos( std:: } -std::vector SIM_MODEL_SOURCE::makeExpParamInfos( std::string aPrefix, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makeExpParamInfos( const std::string& aPrefix, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -611,7 +611,7 @@ std::vector SIM_MODEL_SOURCE::makeExpParamInfos( std::st } -/*std::vector SIM_MODEL_SOURCE::makeSfamParamInfos( std::string aPrefix, std::string aUnit ) +/*std::vector SIM_MODEL_SOURCE::makeSfamParamInfos( const std::string& aPrefix, const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -660,7 +660,7 @@ std::vector SIM_MODEL_SOURCE::makeExpParamInfos( std::st } -std::vector SIM_MODEL_SOURCE::makeSffmParamInfos( std::string aPrefix, std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makeSffmParamInfos( const std::string& aPrefix, const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -726,7 +726,7 @@ std::vector SIM_MODEL_SOURCE::makeSffmParamInfos( std::s }*/ -std::vector SIM_MODEL_SOURCE::makeCcParamInfos( std::string aGainUnit ) +std::vector SIM_MODEL_SOURCE::makeCcParamInfos( const std::string& aGainUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -748,7 +748,7 @@ std::vector SIM_MODEL_SOURCE::makeCcParamInfos( std::str } -std::vector SIM_MODEL_SOURCE::makeVcParamInfos( std::string aGainUnit ) +std::vector SIM_MODEL_SOURCE::makeVcParamInfos( const std::string& aGainUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -771,9 +771,9 @@ std::vector SIM_MODEL_SOURCE::makeVcParamInfos( std::str } -std::vector SIM_MODEL_SOURCE::makePwlParamInfos( std::string aPrefix, - std::string aQuantity, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makePwlParamInfos( const std::string& aPrefix, + const std::string& aQuantity, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -845,8 +845,8 @@ std::vector SIM_MODEL_SOURCE::makePwlParamInfos( std::st } -std::vector SIM_MODEL_SOURCE::makeWhiteNoiseParamInfos( std::string aPrefix, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makeWhiteNoiseParamInfos( const std::string& aPrefix, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -872,8 +872,8 @@ std::vector SIM_MODEL_SOURCE::makeWhiteNoiseParamInfos( } -std::vector SIM_MODEL_SOURCE::makePinkNoiseParamInfos( std::string aPrefix, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makePinkNoiseParamInfos( const std::string& aPrefix, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -907,8 +907,8 @@ std::vector SIM_MODEL_SOURCE::makePinkNoiseParamInfos( s } -std::vector SIM_MODEL_SOURCE::makeBurstNoiseParamInfos( std::string aPrefix, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makeBurstNoiseParamInfos( const std::string& aPrefix, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -942,8 +942,8 @@ std::vector SIM_MODEL_SOURCE::makeBurstNoiseParamInfos( } -std::vector SIM_MODEL_SOURCE::makeRandomUniformParamInfos( std::string aPrefix, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makeRandomUniformParamInfos( const std::string& aPrefix, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -985,8 +985,8 @@ std::vector SIM_MODEL_SOURCE::makeRandomUniformParamInfo } -std::vector SIM_MODEL_SOURCE::makeRandomNormalParamInfos( std::string aPrefix, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makeRandomNormalParamInfos( const std::string& aPrefix, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -1028,8 +1028,8 @@ std::vector SIM_MODEL_SOURCE::makeRandomNormalParamInfos } -std::vector SIM_MODEL_SOURCE::makeRandomExpParamInfos( std::string aPrefix, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makeRandomExpParamInfos( const std::string& aPrefix, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -1071,8 +1071,8 @@ std::vector SIM_MODEL_SOURCE::makeRandomExpParamInfos( s } -std::vector SIM_MODEL_SOURCE::makeRandomPoissonParamInfos( std::string aPrefix, - std::string aUnit ) +std::vector SIM_MODEL_SOURCE::makeRandomPoissonParamInfos( const std::string& aPrefix, + const std::string& aUnit ) { std::vector paramInfos; PARAM::INFO paramInfo; @@ -1113,7 +1113,7 @@ std::vector SIM_MODEL_SOURCE::makeRandomPoissonParamInfo return paramInfos; } -void SIM_MODEL_SOURCE::appendAcParamInfos( std::vector& aParamInfos, std::string aUnit ) +void SIM_MODEL_SOURCE::appendAcParamInfos( std::vector& aParamInfos, const std::string& aUnit ) { PARAM::INFO paramInfo; diff --git a/eeschema/sim/sim_model_source.h b/eeschema/sim/sim_model_source.h index 829fde3090..b20483e3c8 100644 --- a/eeschema/sim/sim_model_source.h +++ b/eeschema/sim/sim_model_source.h @@ -82,25 +82,39 @@ protected: private: static const std::vector& makeParamInfos( TYPE aType ); - static std::vector makeDcParamInfos( std::string aPrefix, std::string aUnit ); - static std::vector makeSinParamInfos( std::string aPrefix, std::string aUnit ); - static std::vector makePulseParamInfos( std::string aPrefix, std::string aUnit ); - static std::vector makeExpParamInfos( std::string aPrefix, std::string aUnit ); - //static std::vector makeSfamParamInfos( std::string aPrefix, std::string aUnit ); - //static std::vector makeSffmParamInfos( std::string aPrefix, std::string aUnit ); - static std::vector makeVcParamInfos( std::string aGainUnit ); - static std::vector makeCcParamInfos( std::string aGainUnit ); - static std::vector makePwlParamInfos( std::string aPrefix, std::string aQuantity, - std::string aUnit ); - static std::vector makeWhiteNoiseParamInfos( std::string aPrefix, std::string aUnit ); - static std::vector makePinkNoiseParamInfos( std::string aPrefix, std::string aUnit ); - static std::vector makeBurstNoiseParamInfos( std::string aPrefix, std::string aUnit ); - static std::vector makeRandomUniformParamInfos( std::string aPrefix, std::string aUnit ); - static std::vector makeRandomNormalParamInfos( std::string aPrefix, std::string aUnit ); - static std::vector makeRandomExpParamInfos( std::string aPrefix, std::string aUnit ); - static std::vector makeRandomPoissonParamInfos( std::string aPrefix, std::string aUnit ); + static std::vector makeDcParamInfos( const std::string& aPrefix, + const std::string& aUnit ); + static std::vector makeSinParamInfos( const std::string& aPrefix, + const std::string& aUnit ); + static std::vector makePulseParamInfos( const std::string& aPrefix, + const std::string& aUnit ); + static std::vector makeExpParamInfos( const std::string& aPrefix, + const std::string& aUnit ); + //static std::vector makeSfamParamInfos( const std::string& aPrefix, + // const std::string& aUnit ); + //static std::vector makeSffmParamInfos( const std::string& aPrefix, + // const std::string& aUnit ); + static std::vector makeVcParamInfos( const std::string& aGainUnit ); + static std::vector makeCcParamInfos( const std::string& aGainUnit ); + static std::vector makePwlParamInfos( const std::string& aPrefix, + const std::string& aQuantity, + const std::string& aUnit ); + static std::vector makeWhiteNoiseParamInfos( const std::string& aPrefix, + const std::string& aUnit ); + static std::vector makePinkNoiseParamInfos( const std::string& aPrefix, + const std::string& aUnit ); + static std::vector makeBurstNoiseParamInfos( const std::string& aPrefix, + const std::string& aUnit ); + static std::vector makeRandomUniformParamInfos( const std::string& aPrefix, + const std::string& aUnit ); + static std::vector makeRandomNormalParamInfos( const std::string& aPrefix, + const std::string& aUnit ); + static std::vector makeRandomExpParamInfos( const std::string& aPrefix, + const std::string& aUnit ); + static std::vector makeRandomPoissonParamInfos( const std::string& aPrefix, + const std::string& aUnit ); - static void appendAcParamInfos( std::vector& aParamInfos, std::string aUnit ); + static void appendAcParamInfos( std::vector& aParamInfos, const std::string& aUnit ); }; #endif // SIM_MODEL_SOURCE_H diff --git a/pcbnew/plugins/kicad/pcb_parser.h b/pcbnew/plugins/kicad/pcb_parser.h index 79ba3b3b5e..3f619081d1 100644 --- a/pcbnew/plugins/kicad/pcb_parser.h +++ b/pcbnew/plugins/kicad/pcb_parser.h @@ -82,7 +82,7 @@ public: m_progressReporter( aProgressReporter ), m_lastProgressTime( std::chrono::steady_clock::now() ), m_lineCount( aLineCount ), - m_queryUserCallback( aQueryUserCallback ) + m_queryUserCallback( std::move( aQueryUserCallback ) ) { init(); } diff --git a/pcbnew/plugins/kicad/pcb_plugin.h b/pcbnew/plugins/kicad/pcb_plugin.h index b6d685cb74..65a9f29b5d 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.h +++ b/pcbnew/plugins/kicad/pcb_plugin.h @@ -277,7 +277,7 @@ public: void SetQueryUserCallback( std::function aCallback ) override { - m_queryUserCallback = aCallback; + m_queryUserCallback = std::move( aCallback ); } void Save( const wxString& aFileName, BOARD* aBoard,