CppCon 2016: Nicholas Ormrod “The strange details of std::string at Facebook"

Channel:CppCon · Length:31:18 · Published:2016-10-05 · Views:122644

Watch on YouTube

Summary

Nicholas Ormrod's CppCon 2016 talk on how Facebook optimizes std::string with its open-source replacement fbstring. It covers storage layout tradeoffs, small string optimization and memory allocation behavior.

Why HN recommends it

HN returns to it as the go-to talk on string internals, small string packing and why small percentage optimizations matter at scale.

it's still definitely worth a watch — HN, 2020

C, C++, Rust, Go & systems languages · Software performance & optimization

Subtitles (excerpt)

hello everyone and welcome to the strange details of standard string at Facebook uh now Nicholas you might ask what could possibly be strange about standard strings and if you'd ask me that question four years ago I wouldn't have had an answer for you but now now I have some answers answers to questions like how are strings implemented why does GCC have a 25 byte null array in most programs and what goes wrong when you are trying to make strings faster the thing is though that these questions here are not why I am here today sure these questions are what I'm here to answer but it's not why this talk exists this talk exists because I am missing the answer to some questions specifically the question that I most want to have an answer to which string is the most efficient string at Facebook which string is the most efficient string for you I don't have that answer I do know a couple of things though and the first most important thing is that strings are important if you look at Facebook code Facebook code includes strings left right and Center I went on to GitHub I cloned a whole bunch of trending C++ projects and they all use strings left right and Center too hello world is a straight program because Hello World includes IO stream but does not include

On Hacker News

You'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: [VIDEO] For a little toy ray tracer, it is pretty measly. But for a larger corporation (with a professional project) a 4% speed improvement can mean MASSIVE cost savings. Some of these tiny improvements can also have a cascading effect. Imagining finding a +… — def-pri-pub, 2026-03
Yes, there are really cool packing techniques. See this talk for example: [VIDEO] I don't include the null-terminator because I use this type in my own environment where I never use null-terminated strings so there is no need for it. — D4ckard, 2024-12
The FAANGS certainly have people doing this kind of work. For example, Andrei Alexandrescu has a bunch of keynote talks at CPPCon where he talks about 1-4% speed optimisations he makes to the std library at Facebook. [LINK] I also like the talk by Nicholas Ormrod “The strange details of std::string at Facebook": [VIDEO] — jiggawatts, 2024-03
I think this is the talk you're referring to. If not, it's still definitely worth a watch: [VIDEO] — pjscott, 2020-01
It was from C++con 2016 - Facebook take on small strings [VIDEO] I believe it is about a page that was conditionally returned to the kernel. — sqrt_1, 2025-05

Related videos