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/include/utils/collection.hpp b/redfish-core/include/utils/collection.hpp
index e73fce3..85a462a 100644
--- a/redfish-core/include/utils/collection.hpp
+++ b/redfish-core/include/utils/collection.hpp
@@ -44,7 +44,7 @@
for (const auto& object : subtree)
{
- auto iter = object.first.rfind("/");
+ auto iter = object.first.rfind('/');
if ((iter != std::string::npos) && (iter < object.first.size()))
{
members.push_back(
diff --git a/redfish-core/include/utils/fw_utils.hpp b/redfish-core/include/utils/fw_utils.hpp
index 6a2ca14..43eded6 100644
--- a/redfish-core/include/utils/fw_utils.hpp
+++ b/redfish-core/include/utils/fw_utils.hpp
@@ -69,7 +69,7 @@
for (auto& fw : *functionalFw)
{
- std::string::size_type idPos = fw.rfind("/");
+ std::string::size_type idPos = fw.rfind('/');
if (idPos == std::string::npos)
{
BMCWEB_LOG_DEBUG << "Can't parse firmware ID!";
@@ -110,7 +110,7 @@
subtree)
{
// if can't parse fw id then return
- std::string::size_type idPos = obj.first.rfind("/");
+ std::string::size_type idPos = obj.first.rfind('/');
if (idPos == std::string::npos)
{
messages::internalError(aResp->res);