Turn on ALL perf checks
1st, alphabetize the tidy-list for good housekeeping.
Next, enable all the clang-tidy performance checks, and resolve all the
issues. most of the issues boil down to:
1. Using std::move on const variables. This does nothing.
2. Passing big variables (like std::string) by value.
3. Using double quotes on a find call, which constructs an intermediate
string, rather than using the character overload.
Tested
Loaded on system, logged in successfully and pulled down webui-vue. No
new errors.
Walked the Redfish tree a bit, and observed no new problems.
Ran redfish service validator. Got no new failures (although there are
a lot of log service deprecation warnings that we should look at).
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I2238958c4b22c1e554e09a0a1787c744bdbca43e
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 9f304b0..80d3e05 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -202,11 +202,10 @@
crow::connections::systemBus->async_method_call(
[aResp, service{connection.first},
- path(std::move(path))](
- const boost::system::error_code ec2,
- const std::vector<
- std::pair<std::string, VariantType>>&
- properties) {
+ path](const boost::system::error_code ec2,
+ const std::vector<
+ std::pair<std::string, VariantType>>&
+ properties) {
if (ec2)
{
BMCWEB_LOG_ERROR
@@ -309,11 +308,10 @@
crow::connections::systemBus->async_method_call(
[aResp, service{connection.first},
- path(std::move(path))](
- const boost::system::error_code ec2,
- const std::vector<
- std::pair<std::string, VariantType>>&
- properties) {
+ path](const boost::system::error_code ec2,
+ const std::vector<
+ std::pair<std::string, VariantType>>&
+ properties) {
if (ec2)
{
BMCWEB_LOG_ERROR
@@ -854,7 +852,8 @@
*
* @return None.
*/
-inline void getBootSource(std::shared_ptr<AsyncResp> aResp, bool oneTimeEnabled)
+inline void getBootSource(const std::shared_ptr<AsyncResp>& aResp,
+ bool oneTimeEnabled)
{
std::string bootDbusObj =
oneTimeEnabled ? "/xyz/openbmc_project/control/host0/boot/one_time"
@@ -894,7 +893,7 @@
"xyz.openbmc_project.Settings", bootDbusObj,
"org.freedesktop.DBus.Properties", "Get",
"xyz.openbmc_project.Control.Boot.Source", "BootSource");
- getBootMode(std::move(aResp), std::move(bootDbusObj));
+ getBootMode(aResp, bootDbusObj);
}
/**
@@ -1141,8 +1140,8 @@
*/
inline void setBootModeOrSource(std::shared_ptr<AsyncResp> aResp,
bool oneTimeEnabled,
- std::optional<std::string> bootSource,
- std::optional<std::string> bootEnable)
+ const std::optional<std::string>& bootSource,
+ const std::optional<std::string>& bootEnable)
{
std::string bootSourceStr =
"xyz.openbmc_project.Control.Boot.Source.Sources.Default";
@@ -1287,8 +1286,7 @@
BMCWEB_LOG_DEBUG << "Got one time: " << *oneTimePtr;
- setBootModeOrSource(aResp, *oneTimePtr, std::move(bootSource),
- std::move(bootEnable));
+ setBootModeOrSource(aResp, *oneTimePtr, bootSource, bootEnable);
},
"xyz.openbmc_project.Settings",
"/xyz/openbmc_project/control/host0/boot/one_time",
@@ -1305,7 +1303,7 @@
* @return None.
*/
inline void setAutomaticRetry(const std::shared_ptr<AsyncResp>& aResp,
- const std::string&& automaticRetryConfig)
+ const std::string& automaticRetryConfig)
{
BMCWEB_LOG_DEBUG << "Set Automatic Retry.";
@@ -2008,8 +2006,7 @@
{
return;
}
- setWDTProperties(asyncResp, std::move(wdtEnable),
- std::move(wdtTimeOutAction));
+ setWDTProperties(asyncResp, wdtEnable, wdtTimeOutAction);
}
if (bootProps)
@@ -2032,13 +2029,13 @@
}
if (automaticRetryConfig)
{
- setAutomaticRetry(asyncResp, std::move(*automaticRetryConfig));
+ setAutomaticRetry(asyncResp, *automaticRetryConfig);
}
}
if (indicatorLed)
{
- setIndicatorLedState(asyncResp, std::move(*indicatorLed));
+ setIndicatorLedState(asyncResp, *indicatorLed);
}
if (powerRestorePolicy)