From 79bccf6bf8cacd17345b7116c3dcb319359b4b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 18 Jan 2023 16:53:06 +0100 Subject: [PATCH] sceneconverter: reserve the mesh array before appending to it. The number of items is known beforehand, so avoid unnecessary reallocations. When mesh LODs are supported this won't be that clear anymore, nevertheless it's never bad to pre-reserve. --- src/Magnum/SceneTools/sceneconverter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Magnum/SceneTools/sceneconverter.cpp b/src/Magnum/SceneTools/sceneconverter.cpp index 7fbdcfda0..86e512e3b 100644 --- a/src/Magnum/SceneTools/sceneconverter.cpp +++ b/src/Magnum/SceneTools/sceneconverter.cpp @@ -858,6 +858,8 @@ well, the IDs reference attributes of the first mesh.)") args.value("remove-duplicate-vertices-fuzzy") || args.arrayValueCount("mesh-converter")) { + arrayReserve(meshes, importer->meshCount()); + for(UnsignedInt i = 0; i != importer->meshCount(); ++i) { Containers::Optional mesh; {