2025-01-14 Shape Keys Performance

@Rikstopher I took your file animated all bones and ran through a profiler.

single core

multi core

so judging by this most time is actually spent drawing the frame?
You can’t see in the screenshot because the callstack is so high, but a significant portion of the drawing is spent in blender::bke::mesh::normals_calc_verts

But that is of course a debug build, let’s get some numbers from a release build by using SCOPED_TIMER_AVERAGED.

CPU: AMD Ryzen 9 9900X 12-Core Processor

- Average
DRW_draw_view 1.95ms
normals_calc_verts 0.54ms
BKE_key_evaluate_object_ex 2.47ms

So in a release build the story shifts a bit. 2.5ms for BKE_key_evaluate_object_ex is still not bad though but there is room for improvement. As far as I can tell the loops in static void key_evaluate_relative are not threaded which might be an easy win. But looking at the code it could use a face lift in general.

Out of curiosity I can that with blender restricted to 4 threads to simulate a less powerful CPU.

- Average
DRW_draw_view 2.82ms
normals_calc_verts 1.43ms
BKE_key_evaluate_object_ex 2.15ms

oddly enough BKE_key_evaluate_object_ex is faster with fewer threads, I ran that a few times just to sanity check. Always the same result within margin of error.

5 Likes