From b95dcb7e7a12ec608d6150f2870c50bb885f1971 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Tue, 21 May 2024 12:19:46 -0500 Subject: [PATCH] Preallocate the indices vector --- irr/src/CGLTFMeshFileLoader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/irr/src/CGLTFMeshFileLoader.cpp b/irr/src/CGLTFMeshFileLoader.cpp index 8747cb8bb..588f19601 100644 --- a/irr/src/CGLTFMeshFileLoader.cpp +++ b/irr/src/CGLTFMeshFileLoader.cpp @@ -275,8 +275,9 @@ std::optional> CGLTFMeshFileLoader::MeshExtractor::getIndices( const auto& buf = getBuffer(accessorIdx.value()); - std::vector indices{}; + std::vector indices; const auto count = getElemCount(accessorIdx.value()); + indices.reserve(count); for (std::size_t i = 0; i < count; ++i) { std::size_t elemIdx = count - i - 1; // reverse index order u16 index;