CS & Compilers
Compilers
General Resources
Algorithms for modern hardware is an amazing online book on algorithms and data structures from the view point of modern architectures. It's one of few texts I've found which actually goes into detail about how to design algorithms with respect to memory hierarchies, modern compilers.
Algorithms for Competitive Programming
The Design of Approximation Algorithms
Data Structures
Hash Tables
Articles and Blog Posts
A series of posts by Malte Skarupke on different Hash Table implementations. He also held a talk at c++now 2018 (see link below)
Videos
-
You Can Do Better than std::unordered_map: New Improvements to Hash Table Performance C++Now 2018 talk by Malte Skarupke comaping different Hash Table implementations (see blog posts above as well).
-
Implementing Understandable World Class Hash Tables in C++ CppCon 2022 talk on implementing a high quality Robin Hood hash table.
-
Hash Tables Video Lecture on hash tables (more of a theoretical nature).
Books
Unfortunately I've read many books which takes very theoretical approach to the subject, but that doesn't help when one wants to implement a good Hash Table (and this is coming from a pure mathematician!).
Memory Management
Memory Allocators
Articles and Blog Posts
There are a lot of good material in this are by Emery Berger Professor at UMass Amherst I'd recommend looking at his personal webpage . I especially recommend the following papers:
The HeapLayer code can be foun on in the github repo emeryberger/Heap-Layers
I would suggest looking at Howard Hinnants short_alloc.h and also his Allocator Boilerplate page which contains the skeleton for a C++11 standard compliant allocator. Note! However that C++17 allocator reduces this even further.
Article series on the website gingerBill. Nice articles covering the most commonly used allocation strategies, code in C.
- Part 1 Overview/Background
- Part 2 Linear/Arena Allocators
- Part 3 Stack Allocators
- Part 4 Pool Allocators
- Part 5 Free List Allocators
- Part 6 Buddy Allocators
Videos
- std::allocator... CppCon talk by Andrei Alexandrescu on allocators and flaws in the design of the std::allocator.
- Practical Memory Pool Based Allocators For Modern C++ CppCon talk on memory pool based allocators.
- How To Write a Custom Allocator CppCon talk.
- How to implement a memory pool Video implementing a simple memory pool in C++.
Books
There are many books that mention custom allocators, however only a few actually do more than just scratch the surface. Here are three books which treats allocators somewhat in depth.
-
Chapter 7 of The Garbage Garbage Collection Handbook treats allocators and allocation strategies and provides plenty of algorithms in pseudocode and additional references.
-
Chapter 6 of Game Engine Architecture also goes through
-
Chapter 4 of Modern C++ Design builds a custom allocator in C++. NOTE: Andrei prefers another approach to compose custom allocators as in Heap Layer this is mentioned in the Policy Design ... paper. However the specific ideas for how to write a small object allocator are still valid.