bring back fbstring for PathComponent - reduces PathMap memory usage

Summary:
In my benchmarks, using fbstring over std::string for PathMap is
worthwhile.  There are a lot of entries stored in PathMap and the fact
that fbstring is a word smaller than std::string adds up.

Differential Revision: D6820204

fbshipit-source-id: 1ac34a81828891eb8125b13a074de6ed9715edad
This commit is contained in:
Chad Austin 2018-01-26 10:40:26 -08:00 committed by Facebook Github Bot
parent ec9ff7e3ef
commit 13176097df
2 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,7 @@
#pragma once
#include <boost/operators.hpp>
#include <folly/Expected.h>
#include <folly/FBString.h>
#include <folly/Format.h>
#include <folly/String.h>
#include <folly/hash/Hash.h>
@ -87,7 +88,10 @@ template <typename STR>
class AbsolutePathBase;
} // namespace detail
using PathComponent = detail::PathComponentBase<std::string>;
// Intentionally use folly::fbstring because Dir entries are keyed on
// PathComponent and the fact that folly::fbstring is 24 bytes and std::string
// is 32 bytes adds up.
using PathComponent = detail::PathComponentBase<folly::fbstring>;
using PathComponentPiece = detail::PathComponentBase<folly::StringPiece>;
using RelativePath = detail::RelativePathBase<std::string>;

View File

@ -60,6 +60,7 @@ cpp_library(
deps = [
"//folly:exception",
"//folly:expected",
"//folly:fbstring",
"//folly:format",
"//folly:optional",
"//folly:string",