Faster repeated append (particularly for short strings)
Summary:
https://phabricator.fb.com/
D544159 reveals a large performance gap between
fbstring and std::string for repeated appends of short strings, which I
consider a relatively urgent matter (as much of our code uses such patterns).
This diff attempts to fix the issue in a principled manner by first appending
the first character with exponential reallocation, after which the rest of the
characters are appended normally.
With the proposed fix the benchmarks are much faster than the previous fbstring
and also than std::string (numbers to follow in comments).
Test Plan: unittested and benchmarked
Reviewed By: soren@fb.com
FB internal diff:
D545416