mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 08:57:26 +00:00
tint/resolver: Pre-allocate containers
Reserve the memory for the dependency graph containers. Reduces expensive heap allocations. Change-Id: Ia650fcb9f9e461afb8b240c9472a9a478a9968d1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98081 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
6d66921053
commit
7d04cedce3
@@ -93,6 +93,13 @@ struct UniqueVector {
|
||||
/// @returns a const reference to the internal vector
|
||||
operator const std::vector<T>&() const { return vector; }
|
||||
|
||||
/// Pre-allocates `count` elements in the vector and set
|
||||
/// @param count the number of elements to pre-allocate
|
||||
void reserve(size_t count) {
|
||||
vector.reserve(count);
|
||||
set.reserve(count);
|
||||
}
|
||||
|
||||
/// Removes the last element from the vector
|
||||
/// @returns the popped element
|
||||
T pop_back() {
|
||||
|
||||
Reference in New Issue
Block a user