Commit 50d93463 authored by Anton Likhtarov's avatar Anton Likhtarov Committed by Facebook Github Bot

Perf: easy, don't inline the slow path of tlValue

Summary: inline the small, fast path only

Differential Revision: D9982097

fbshipit-source-id: f1bcbab2b444d372e178aa548175a5c27be972b6
parent e948b514
......@@ -120,7 +120,14 @@ class SettingCore : public SettingCoreBase {
Indestructible<std::pair<size_t, std::shared_ptr<Contents>>>>>
localValue_;
std::shared_ptr<Contents>& tlValue() {
FOLLY_ALWAYS_INLINE std::shared_ptr<Contents>& tlValue() {
auto& value = ***localValue_;
if (LIKELY(value.first == *globalVersion_)) {
return value.second;
}
return tlValueSlow();
}
FOLLY_NOINLINE std::shared_ptr<Contents>& tlValueSlow() {
auto& value = ***localValue_;
while (value.first < *globalVersion_) {
/* If this destroys the old value, do it without holding the lock */
......
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