Kill writeTerminator in fbstring
Summary:
`writeTerminator` needs to determine the string category, and in the small case, also its size. This information is often known, but the compiler cannot optimize it away especially if `capacity_` was just overwritten. Also, some occurrences are just redundant. We can remove the latter and specialize the former.
Small operations such as `push_back` are up to 40% faster.
Before/after:
```
$ ./fbstring_benchmark_using_jemalloc --bm_regex '_fbstring' --bm_min_usec 200000 --bm_max_secs 2
============================================================================ ===================
./folly/test/FBStringTestBenchmarks.cpp.h relative time/iter iters/s time/iter iters/s
============================================================================ ===================
BM_initRNG_fbstring(0) 0.00fs Infinity 0.00fs Infinity
BM_defaultCtor_fbstring(0) 6.82us 146.60K 6.26us 159.74K
BM_copyCtor_fbstring(32768) 16.86ns 59.32M 15.50ns 64.52M
BM_ctorFromArray_fbstring(32768) 2.25us 444.78K 2.12us 471.58K
BM_ctorFromTwoPointers_fbstring(0) 9.76ns 102.44M 7.85ns 127.35M
BM_ctorFromTwoPointers_fbstring(7) 9.68ns 103.32M 8.10ns 123.47M
BM_ctorFromTwoPointers_fbstring(15) 9.77ns 102.34M 8.12ns 123.17M
BM_ctorFromTwoPointers_fbstring(23) 9.46ns 105.68M 8.78ns 113.88M
BM_ctorFromTwoPointers_fbstring(24) 31.23ns 32.02M 30.71ns 32.56M
BM_ctorFromChar_fbstring(
1048576) 40.04ns 24.97M 35.68ns 28.03M
BM_assignmentOp_fbstring(256) 66.76ns 14.98M 63.93ns 15.64M
BM_assignmentFill_fbstring(0) 8.23ns 121.47M 7.02ns 142.49M
BM_resize_fbstring(524288) 4.09us 244.63K 3.94us 253.84K
BM_equality_fbstring(65536) 2.47ms 404.63 2.19ms 455.92
BM_replace_fbstring(256) 172.36ns 5.80M 159.10ns 6.29M
BM_push_back_fbstring(1) 9.32ns 107.27M 7.79ns 128.40M
BM_push_back_fbstring(23) 252.44ns 3.96M 158.31ns 6.32M
BM_push_back_fbstring(127) 721.50ns 1.39M 515.08ns 1.94M
BM_push_back_fbstring(1024) 5.21us 191.87K 3.14us 318.03K
BM_short_append_fbstring(23) 431.71ns 2.32M 335.74ns 2.98M
BM_short_append_fbstring(1024) 11.96us 83.64K 9.19us 108.78K
BM_getline_fbstring(23) 57.06ns 17.53M 39.78ns 25.14M
BM_getline_fbstring(1000) 232.26ns 4.31M 203.24ns 4.92M
============================================================================ ===================
```
(`find` benchmarks were removed due to high variance caused by randomness)
Reviewed By: luciang
Differential Revision:
D2879646
fb-gh-sync-id:
10fd8573495d285220ae98858d11de9ec6d97e54