Browse Source

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.
pull/601/head
Vladimír Vondruš 3 years ago
parent
commit
79bccf6bf8
  1. 2
      src/Magnum/SceneTools/sceneconverter.cpp

2
src/Magnum/SceneTools/sceneconverter.cpp

@ -858,6 +858,8 @@ well, the IDs reference attributes of the first mesh.)")
args.value<Containers::StringView>("remove-duplicate-vertices-fuzzy") ||
args.arrayValueCount("mesh-converter"))
{
arrayReserve(meshes, importer->meshCount());
for(UnsignedInt i = 0; i != importer->meshCount(); ++i) {
Containers::Optional<Trade::MeshData> mesh;
{

Loading…
Cancel
Save