Commit eb4eaea9b8edc50e52054cf9f50b7273e4926684

Charlie Lao 2024-10-03T17:15:21

Vulkan: Improve SharedCacheKeyManager::addKey performance This function walks a vector of keys. When there are many keys this could be slow. Also when we have to grow the vector size, it involves memory reallocation which means copy the data from old storage to new storage. This CL changes mSharedCacheKeys to use std::deque instead of vector which solves storage reallocation problem. It also adds angle::BitSet64<64> to track all available (i.e., empty) slots in mSharedCacheKeys so that we don't have to loop most of time. You only loop all keys once to find all empty slots and then subsequent addKey() call will be O(1) until all empty slots are used. Bug: b/368566032 Change-Id: I4d32b461761f1cd64380f5527883b84357bb44c1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5908690 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>