Enabling the string performance clang-tidy rules should be fine and easy.
E.g. on aarch64, when running the BlockToJsonVerboseWrite bench, I can see a minimal 0.3% drop in instructions and 0.6% drop in branches.
Enabling the string performance clang-tidy rules should be fine and easy.
E.g. on aarch64, when running the BlockToJsonVerboseWrite bench, I can see a minimal 0.3% drop in instructions and 0.6% drop in branches.
No need to create a std::string copy
It is an alias of the previously enabled rule. See https://releases.llvm.org/23.1.0/tools/clang/tools/extra/docs/clang-tidy/checks/performance/faster-string-find.html
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline and AI policy for information on the review process.
| Type | Reviewers |
|---|---|
| ACK | stickies-v, hebasto, l0rinc |
If your review is incorrectly listed, please copy-paste <code><!--meta-tag:bot-skip--></code> into the comment that the bot should ignore.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
ACK bbbb9c6d73a3750185c62bcb520b6ba74ac34be9
nit: util:subprocess.h:1091 contains a performance-prefer-single-char-overloads violation, not currently checked in CI because it's in an #ifdef WIN32 block1
re-ACK fabb6bbe53e9cba85b62da2416287c41975d71dd
ACK fabb6bbe53e9cba85b62da2416287c41975d71dd.
1230 | @@ -1231,7 +1231,7 @@ void RPCResult::CheckInnerDoc() const 1231 | std::string RPCArg::ToStringObj(const bool oneline) const 1232 | { 1233 | std::string res; 1234 | - res += "\""; 1235 | + res += '\"';
nit: we don't need to escape " anymore:
res += '"';
If you decide to apply this, please consider this one, too:
diff --git a/src/rest.cpp b/src/rest.cpp
--- a/src/rest.cpp (revision 9f63677902b51a3582d2d232e570b725ec9082ed)
+++ b/src/rest.cpp (date 1792500052439)
@@ -179,7 +179,7 @@
std::string formats;
for (const auto& rf_name : rf_names) {
if (strlen(rf_name.name) > 0) {
- formats.append(".");
+ formats += '.';
formats.append(rf_name.name);
formats.append(", ");
}
thx, I'll roll them into one of my other pulls, to avoid review churn here
ACK fabb6bbe53e9cba85b62da2416287c41975d71dd
Manually went over each one, change seems boring and trivial. I don't think of it as an optimization, but rather as reenabling suppressed tidy rules. Let non-blocking nit only, lgtm.