Do not copy std::vector of OS handles when it is not needed

This change replaces unneeded copying of std::vectors
with usage of const references. Furthermore, it adds
reserve() call before filling the container via push_back().

Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:
Patryk Wrobel
2022-10-20 22:18:08 +00:00
committed by Compute-Runtime-Automation
parent 40ddeeb3ba
commit 9b26e96b11
14 changed files with 17 additions and 15 deletions

View File

@@ -508,6 +508,8 @@ ze_result_t ContextImp::openIpcMemHandles(ze_device_handle_t hDevice,
ze_ipc_memory_flags_t flags,
void **pptr) {
std::vector<NEO::osHandle> handles;
handles.reserve(numIpcHandles);
for (uint32_t i = 0; i < numIpcHandles; i++) {
uint64_t handle = 0;
memcpy_s(&handle,