Avoid creating temporary objects in FiterValue().
It reduces the cpu time from 1000ns to 750ns
Test: statsd test.
Change-Id: Ifa7e98e3368f8d55f85c7b09d05a6c416482981d
diff --git a/cmds/statsd/src/FieldValue.cpp b/cmds/statsd/src/FieldValue.cpp
index 6894bcf..b541612 100644
--- a/cmds/statsd/src/FieldValue.cpp
+++ b/cmds/statsd/src/FieldValue.cpp
@@ -135,6 +135,8 @@
case STRING:
str_value = from.str_value;
break;
+ default:
+ break;
}
}
@@ -148,6 +150,8 @@
return std::to_string(float_value) + "[F]";
case STRING:
return str_value + "[S]";
+ default:
+ return "[UNKNOWN]";
}
}
@@ -163,6 +167,8 @@
return float_value == that.float_value;
case STRING:
return str_value == that.str_value;
+ default:
+ return false;
}
}
@@ -177,6 +183,8 @@
return float_value != that.float_value;
case STRING:
return str_value != that.str_value;
+ default:
+ return false;
}
}