Fabric: Using small_vector instead of regular vector in some hot code paths

Summary: The hope is that it will remove many unnececery allocations improving overal perfromance.

Reviewed By: mdvacca

Differential Revision: D14249198

fbshipit-source-id: f0442b3919ccead0582a3190dea0e33d517d85f6
This commit is contained in:
Valentin Shergin
2019-03-07 13:38:10 -08:00
committed by Facebook Github Bot
parent c3ecae0db4
commit 2862ef3a47
7 changed files with 27 additions and 11 deletions

View File

@@ -70,7 +70,7 @@ void AttributedString::prependAttributedString(
attributedString.fragments_.end());
}
const std::vector<Fragment> &AttributedString::getFragments() const {
const Fragments &AttributedString::getFragments() const {
return fragments_;
}

View File

@@ -44,7 +44,7 @@ class AttributedString : public Sealable, public DebugStringConvertible {
bool operator!=(const Fragment &rhs) const;
};
using Fragments = std::vector<Fragment>;
using Fragments = better::small_vector<Fragment, 1>;
/*
* Appends and prepends a `fragment` to the string.