CppCon 2015: Andrei Alexandrescu “std::allocator...”
Why Hacker News recommends it
HN repeatedly recommends it as an entertaining, mind-opening talk on allocator design and composable generic programming.
What it is
Andrei Alexandrescu's CppCon 2015 talk argues that std::allocator is badly designed. He proposes building high-performance allocators from small composable, templated pieces.
Recommended by 7 HN commenters across 11 different months, 2017 to 2025.
What Hacker News said
Strong rec nly · 2017-05 · on “The Horror in the Standard Library”
Actually it is C's malloc and free that is "broken". malloc() takes a size parameter, but free() doesn't. This imbalance means it can never be maximally efficient. Whatever GNU stdlibc++ is doing is probably, on balance, a net win for most programs. It's not exactly roses in C++ either of course. You can do better than the standard library facilities. Andrei Alexandrescu gave a great, entertaining, and technically elegant talk on memory allocation in C and C++ at Cppcon 2015 that is well worth watching [this video]
Strong rec p0nce · 2018-12 · on “Using D to Create the World’s Fastest File System”
> I would have liked to hear more about what exactly made D so great This WIP article explains very well the USP of D: [LINK] (section 3) This article highlight the value of "design-by-introspection" applied to a particular problem space: [LINK] This talk present a concrete example of such: [this video] (mind bending stuff) You might not understand what is new about it, but soon your competitors will understand it.
Strong rec favorited · 2020-04 · on “Benchmarking C++ Allocators”
A bit unrelated, but if anyone is interested, I recently watched Andrei Alexandrescu's 2015 talk about a composable allocator design in C++ and it was really interesting. And Andrei's presentation style was fantastic, per usual. Note that this talk is about a std::allocator-like type, potentially on top of one of malloc/jemalloc/etc. [this video]
Strong rec favorited · 2020-10 · on “Custom Allocators Demystified”
Andrei Alexandrescu's 2015 talk about C++'s allocators is great. He's a very entertaining presenter, and he makes case for extremely composable templated allocators (and why std::allocator isn't that). [this video]
Strong rec jiggawatts · 2020-12 · on “Writing a Memory Allocator (2019)”
Every time I hear someone talking about writing a memory allocator, it always reminds me of the brilliant CppCon 2015 talk by Andrei Alexandrescu about how he wrote an modular allocator library that can be built up in pieces to make whatever you like. [this video]
Strong rec jiggawatts · 2023-01 · on “Ask HN: What's the best lecture series you've ever seen?”
Not exactly a lecture series, but Andrei Alexandrescu has had some fantastic keynote presentations at CppCon. I don't even program in C++ any more, but I've watched these more than once, they're entertaining, approachable, and inspiring: Speed Is Found In The Minds of People [LINK] std::allocator Is to Allocation what std::vector Is to Vexation [this video] An actual lecture series I've enjoyed watching is "The WE-Heraeus International Winter School on Gravity and Light", which covers General Relativity using modern mathematical approaches: [LINK] Again, I haven't done physics in 20 years, but I've found it surprisingly easy to follow because it is so clearly presented.
Strong rec jiggawatts · 2025-01 · on “Comptime as Configuration”
> The issue with this approach is that the more you can control, the less the compiler can assume. That's absolutely true, but there's a workaround, albeit a complicated one. The compiler internals need the same kind of constraints or traits that abstract code such as language interfaces or template parameters can have. These can then be used to constrain the internals in a way that then would allow assumptions to be safely "plumbed through" the various layers. The (big!) challenge here is that these abstractions haven't been well-developed in the industry. Certainly nowhere near as well as the typical runtime "type theory" as seen in modern languages. > some very basic ones like allocating
Recommends badsectoracula · 2017-06 · on “Show HN: Crown – A flexible game engine written from scratch in C++”
Generally speaking many C++ game engines avoid the STL stuff and reimplement their own more predictable containers, often with custom allocation schemes. The engine at the last game company i worked at, for example, had its own containers and memory allocator and allowed you to define the allocation category and pool per allocator and per object class (so, e.g., dynamic strings would be isolated to their own pool to avoid fragmenting the heap). Related, Andrei Alexandrescu had a great talk about allocators in C++ a couple of years ago: [this video] Also related to the Orthodox C++, the same engine also ousted exceptions and RTTI. I'm not sure about the reason for exceptions, but C++'s RTTI was si