~/talk

The strange details of std::string at Facebook

Talkat CppCon 2016 · 2016-09-18..09-23· [software-architecture]
links:none on file
slides:none on file

Shows concrete internals: GCC 4 uses a 25-byte global empty string plus copy-on-write with refcount-minus-one, while Facebook's fbstring uses a 24-byte struct with SSO storing up to 23 in-situ bytes and stores flags in low bits via JMalloc buckets. Replacing std::string at Facebook in 2012 yields a 1% performance win company-wide. Covers perf and perf counters, a cache-line–trashing c_str bug at a page boundary, the attempted removal of the null terminator, and tradeoffs after GCC5 switches to a 32-byte std::string with only 15-byte SSO.

AI-written summary · about

  1. 0:00Introduction to std::string
  2. 1:06Why strings matter at Facebook
  3. 2:11How GCC implements std::string
  4. 5:32GCC string optimizations
  5. 6:39FB string vs GCC string
  6. 8:23Small string optimization in FB string
  7. 13:21Clang and Microsoft string implementations
  8. 14:45Performance comparison of FB and GCC strings
  9. 17:15Replacing standard string with FB string
  10. 19:00Removing the null terminator
  11. 21:08The const c_str() problem
  12. 23:17The most complex bug in FB string
  13. 26:05GCC 5’s new string layout
  14. 29:16GCC 5 vs FB string trade-offs
  15. 30:19Conclusion and future of std::string
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.