utils: Add FastStrcmp.h
Move existing fast<str*cmp> templates for general use, pulled from
the implementation used in logd that dealt with speed through cache
locality and subroutine call mitigation. Rename to fastcmp.
Test: logd-benchmarks and based on manual profiling from the past
Bug: 31456426
Change-Id: Ic62f4a437fc3e06ffdeaae73a6f34e197957a6b0
diff --git a/logd/LogStatistics.h b/logd/LogStatistics.h
index 1f598af..cb7ae2b 100644
--- a/logd/LogStatistics.h
+++ b/logd/LogStatistics.h
@@ -307,7 +307,7 @@
const char*getName() const { return name; }
inline void add(pid_t newPid) {
- if (name && !fast<strncmp>(name, "zygote", 6)) {
+ if (name && !fastcmp<strncmp>(name, "zygote", 6)) {
free(name);
name = NULL;
}
@@ -368,7 +368,7 @@
const char*getName() const { return name; }
inline void add(pid_t incomingTid) {
- if (name && !fast<strncmp>(name, "zygote", 6)) {
+ if (name && !fastcmp<strncmp>(name, "zygote", 6)) {
free(name);
name = NULL;
}