Commit 3020a18c authored by Cornel Rat's avatar Cornel Rat Committed by Facebook Github Bot

Use F14 for the RequestToken cache

Summary: Looks like switching to F14 speeds up RequestToken creation by ~25% in some projects.

Reviewed By: yfeldblum

Differential Revision: D10518982

fbshipit-source-id: bf924a0a86f940f7ed36526ca6eda4fe1421f5f8
parent c227ceae
...@@ -57,10 +57,8 @@ std::string RequestToken::getDebugString() const { ...@@ -57,10 +57,8 @@ std::string RequestToken::getDebugString() const {
throw std::logic_error("Could not find debug string in RequestToken"); throw std::logic_error("Could not find debug string in RequestToken");
} }
Synchronized<std::unordered_map<std::string, uint32_t>>& Synchronized<F14FastMap<std::string, uint32_t>>& RequestToken::getCache() {
RequestToken::getCache() { static Indestructible<Synchronized<F14FastMap<std::string, uint32_t>>> cache;
static Indestructible<Synchronized<std::unordered_map<std::string, uint32_t>>>
cache;
return *cache; return *cache;
} }
......
...@@ -44,7 +44,7 @@ class RequestToken { ...@@ -44,7 +44,7 @@ class RequestToken {
friend struct std::hash<folly::RequestToken>; friend struct std::hash<folly::RequestToken>;
private: private:
static Synchronized<std::unordered_map<std::string, uint32_t>>& getCache(); static Synchronized<F14FastMap<std::string, uint32_t>>& getCache();
uint32_t token_; uint32_t token_;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment