From 399498fdc0c2d60a205a5ca4137dd67e0124860d Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Fri, 12 Jul 2024 03:30:14 +0200 Subject: [PATCH] Fix: Slow versioning on files with many meshes due to unnecessary loop Unlike most versioning helper functions, version_mesh_crease_generic takes care of all meshes in the blend file. However, the versioning code was looping over all meshes and calling it for each one anyways. This doesn't do anything after the first iteration, but it results in quadratic time complexity w.r.t. number of meshes and manages to waste e.g. 600ms when loading the Spring benchmark file. --- source/blender/blenloader/intern/versioning_400.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/blender/blenloader/intern/versioning_400.cc b/source/blender/blenloader/intern/versioning_400.cc index da533106093..7b178866046 100644 --- a/source/blender/blenloader/intern/versioning_400.cc +++ b/source/blender/blenloader/intern/versioning_400.cc @@ -2799,9 +2799,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) } if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 7)) { - LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) { - version_mesh_crease_generic(*bmain); - } + version_mesh_crease_generic(*bmain); } if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 8)) {