CppCon 2016: Nicholas Ormrod “The strange details of std::string at Facebook"
CppCon · 5 位 HN 用户推荐 · 2020–2026
I think this is the talk you're referring to. If not, it's still definitely worth a watch: [link]
— pjscott, 2020There's a pretty good CppCon talk about how they made std::string suck less at facebook [link]
— tuckerpo, 2020Unusually, C skips the 'length' value for strings by using null-termination, so C strings are often just 16 bytes (8 for the pointer, and 8 for the allocated object on the heap, assuming some sort of small-object optimisation is going on). The approach in C++ is to use "small string optimisation" where the string values are inlined into the std::string structure itself. This works up to 23 bytes
— jiggawatts, 2023Obligatory link to a must watch, the CppCon 2016 talk on the complexities of std::string: [link]
— kingsleyopara, 2024You'd be surprised how it actually is worth the effort, even just a 1% improvement. If you have the time, this is a great talk to listen to: [link]
— def-pri-pub, 2026