Remove redundant copying of std::vectors

Usage of initializer list in for loop to iterate over heavy types
has bad consequences. std::initialize_list is only a view and its
data is silently created as T[N]. Therefore, if someone uses
std::vector with it, it will cause deep-copying of the elements.

This change introduces usage of pointers on std::initializer_list
to perform a shallow-copy of an addresses. Furthermore, it adds
const references in few places, where copy is not needed.

Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:
Patryk Wrobel
2022-08-12 16:57:46 +00:00
committed by Compute-Runtime-Automation
parent 3778a371fd
commit 44e1f1ba4b
6 changed files with 23 additions and 22 deletions

View File

@@ -161,7 +161,7 @@ bool OclocArgHelper::getHwInfoForProductConfig(uint32_t productConfig, NEO::Hard
return retVal;
}
auto deviceAotMap = productConfigHelper->getDeviceAotInfo();
const auto &deviceAotMap = productConfigHelper->getDeviceAotInfo();
for (auto &deviceConfig : deviceAotMap) {
if (deviceConfig.aotConfig.ProductConfig == productConfig) {
hwInfo = *deviceConfig.hwInfo;