RNA: speedup rna path creation in simple but common case

This speeds up saving the following production file by about 10%:
`240ms -> 220ms`
`heist/pro/shots/060_fight/060_0080/060_0080.anim.blend`

This is a fairly low hanging fruit. Ideally we wouldn't have to duplicate
the string at all, but changing that is a larger undertaking.
This commit is contained in:
Jacques Lucke
2023-10-13 18:41:27 +02:00
parent 5b1d5fa82f
commit 71feaba657

View File

@@ -1098,7 +1098,13 @@ static char *rna_path_from_ptr_to_property_index_ex(
}
else {
if (is_rna) {
path = BLI_sprintfN("%s%s", propname, index_str);
if (index_dim == 0) {
/* Use direct duplication instead of #BLI_sprintfN because it's faster. */
path = BLI_strdup(propname);
}
else {
path = BLI_sprintfN("%s%s", propname, index_str);
}
}
else {
char propname_esc[MAX_IDPROP_NAME * 2];