More profiler driven tweaks.

Make more code inlinable by moving to header files.
Use reserve on std::vectors to avoid reallocation.

Change-Id: I1bf67d32dd58ff5c06dec73a247fadc3de593e91
diff --git a/src/base/stringpiece.h b/src/base/stringpiece.h
index 193f5f7..3664218 100644
--- a/src/base/stringpiece.h
+++ b/src/base/stringpiece.h
@@ -188,7 +188,11 @@
   return !(x == y);
 }
 
-bool operator<(const StringPiece& x, const StringPiece& y);
+inline bool operator<(const StringPiece& x, const StringPiece& y) {
+  const int r = memcmp(x.data(), y.data(),
+                       std::min(x.size(), y.size()));
+  return ((r < 0) || ((r == 0) && (x.size() < y.size())));
+}
 
 inline bool operator>(const StringPiece& x, const StringPiece& y) {
   return y < x;