diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-03-26 21:12:25 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-03-31 23:01:40 -0400 |
commit | abd5e7dec039386628223f886b33047734172c8d (patch) | |
tree | ca3aecd64e1e9375ab6ed48d4a7dc54ac83b584d /src/libutil/chunked-vector.hh | |
parent | 8ae9d669409851acb6de39335b11a95a991eae6d (diff) |
Extend internal API docs, part 2
Picking up from #8111.
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
Diffstat (limited to 'src/libutil/chunked-vector.hh')
-rw-r--r-- | src/libutil/chunked-vector.hh | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/libutil/chunked-vector.hh b/src/libutil/chunked-vector.hh index 0a4f0b400..cafeb5049 100644 --- a/src/libutil/chunked-vector.hh +++ b/src/libutil/chunked-vector.hh @@ -7,20 +7,24 @@ namespace nix { -/* Provides an indexable container like vector<> with memory overhead - guarantees like list<> by allocating storage in chunks of ChunkSize - elements instead of using a contiguous memory allocation like vector<> - does. Not using a single vector that is resized reduces memory overhead - on large data sets by on average (growth factor)/2, mostly - eliminates copies within the vector during resizing, and provides stable - references to its elements. */ +/** + * Provides an indexable container like vector<> with memory overhead + * guarantees like list<> by allocating storage in chunks of ChunkSize + * elements instead of using a contiguous memory allocation like vector<> + * does. Not using a single vector that is resized reduces memory overhead + * on large data sets by on average (growth factor)/2, mostly + * eliminates copies within the vector during resizing, and provides stable + * references to its elements. + */ template<typename T, size_t ChunkSize> class ChunkedVector { private: uint32_t size_ = 0; std::vector<std::vector<T>> chunks; - /* keep this out of the ::add hot path */ + /** + * Keep this out of the ::add hot path + */ [[gnu::noinline]] auto & addChunk() { |