Random thoughts on C++ containers:
- The major game engines do their own std::vector's, yet it's difficult to find good drop-in std::vector replacements on the web.
- As far as I know std::vector can't take advantage of realloc() on trivial types, which seems like an easy win.
6
1
33
For example, if you see a uint64 vector being created at a certain callsite, and the app always push_back's 256 elements into the container, you can use this history to optimize the container's behavior.
9:21 AM ยท Jan 16, 2021
2
0
2
- A good std::vector communicates deeply with the underlying heap implementation. After allocating a block, the vector should immediately query the heap to get that block's *actual* size so it can exploit that entire block's allocation.
3
0
6
- A vector for large arrays can take advantage of virtual memory to grow blocks one page at a time
1
0
0

