Page MenuHome

Surface Deform: optimize memory allocation in the evaluation code.
ClosedPublic

Authored by Alexander Gavrilov (angavrilov) on Jan 7 2021, 7:10 PM.

Details

Summary

Using malloc to allocate a temporary array for each vertex,
which most commonly contains just 4 elements, is not efficient.
Checking the mode with a switch is also better.

Finally, a one line UI fix: the strength option is not bind specific.

Diff Detail

Repository
rB Blender

Event Timeline

Alexander Gavrilov (angavrilov) requested review of this revision.Jan 7 2021, 7:10 PM

Nice, TIL about both __builtin_expect and __builtin_alloca.

I tested this locally, and at least for the common case it seems to work. I couldn't figure out how to trip the big_buffer condition.

Out of curiosity, did you do any bench-marking around how big an impact this has?

Also, the UI change seems pretty unrelated, could we split that into a separate patch just to keep patches single-purpose?

LGTM, UI change should be committed separately though.

This revision is now accepted and ready to land.Jan 8 2021, 10:12 AM