4 `fbstring` is a drop-in replacement for `std::string`. The main
5 benefit of `fbstring` is significantly increased performance on
6 virtually all important primitives. This is achieved by using a
7 two-tiered storage strategy and by cooperating with the memory
8 allocator. In particular, `fbstring` is designed to detect use of
9 jemalloc and cooperate with it to achieve significant improvements in
10 speed and memory usage.
12 `fbstring` supports 32- and 64-bit and little- and big-endian
15 ### Storage strategies
18 * Small strings (<= 23 chars) are stored in-situ without memory
21 * Other strings (> 23 chars) are stored in malloc-allocated
22 memory and copied eagerly.
24 ### Implementation highlights
27 * 100% compatible with `std::string`.
29 * Uses `malloc` instead of allocators.
31 * Jemalloc-friendly. `fbstring` automatically detects if application
32 uses jemalloc and if so, significantly improves allocation
33 strategy by using non-standard jemalloc extensions.
35 * `find()` is implemented using simplified Boyer-Moore
36 algorithm. Casual tests indicate a 30x speed improvement over
37 `string::find()` for successful searches and a 1.5x speed
38 improvement for failed searches.
40 * Offers conversions to and from `std::string`.