From 49f4b643b997d81002aced2eb2b55dee3e101bb2 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 6 Feb 2024 13:53:03 +0100 Subject: [PATCH] LibOverride: avoid unnecessary GHash lookup In my test file with many bones (very few of which have an override) this leads to a 5-10% speedup when saving the file. Pull Request: https://projects.blender.org/blender/blender/pulls/117803 --- .../intern/rna_access_compare_override.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/blender/makesrna/intern/rna_access_compare_override.cc b/source/blender/makesrna/intern/rna_access_compare_override.cc index fe1d78683e4..7e81171a469 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.cc +++ b/source/blender/makesrna/intern/rna_access_compare_override.cc @@ -779,12 +779,13 @@ bool RNA_struct_override_matches(Main *bmain, CLOG_INFO(&LOG, 5, "Override Checking %s", rna_path->c_str()); - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(liboverride, - rna_path->c_str()); - if (ignore_overridden && op != nullptr) { - BKE_lib_override_library_operations_tag(op, LIBOVERRIDE_PROP_OP_TAG_UNUSED, false); - - continue; + if (ignore_overridden) { + IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(liboverride, + rna_path->c_str()); + if (op != nullptr) { + BKE_lib_override_library_operations_tag(op, LIBOVERRIDE_PROP_OP_TAG_UNUSED, false); + continue; + } } #ifdef DEBUG_OVERRIDE_TIMEIT @@ -819,7 +820,8 @@ bool RNA_struct_override_matches(Main *bmain, if (diff != 0) { /* XXX TODO: refine this for per-item overriding of arrays... */ - op = BKE_lib_override_library_property_find(liboverride, rna_path->c_str()); + IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(liboverride, + rna_path->c_str()); IDOverrideLibraryPropertyOperation *opop = static_cast( op ? op->operations.first : nullptr);