Page MenuHome

Speedup: DNA_elem_array_size

Authored by Jacques Lucke (JacquesLucke) on Dec 5 2018, 8:34 PM.



I started learning how to do some basic performance profiling for Blender. I mostly tested loading scenes from Spring.

The DNA_elem_array_size function turned out to be relatively slow.
In my test the function was executed almost 11 million times and was responsible for 6.8% of the execution time.
This change roughly halved this time. I did two runs with and without this change (didn't do more because it takes forever).

Diff Detail

rB Blender

Event Timeline

Jacques Lucke (JacquesLucke) planned changes to this revision.Dec 6 2018, 9:28 AM
Jacques Lucke (JacquesLucke) added inline comments.

Just noticed that this assert is probably wrong. Will test when I'm in office.

  • fix and minor speedup

Just a side note: It is totally fine when the actual name also contains numbers. They will be discarded when the first [ comes.

I find that the best way to show the actual impact of this is to show the total amount of events callgrind measured when loading a specific file from Spring. I did the tests interleaved and multiple times.

Blender 2.8:

Original version of this patch:

New version of this patch:

I'll leave the interpretation of the numbers up to you. But I think this local change reduces the total amount of executed instructions by a surprisingly large amount.

This revision is now accepted and ready to land.Dec 6 2018, 2:09 PM
This revision was automatically updated to reflect the committed changes.