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.
Differential D10040
Surface Deform: optimize memory allocation in the evaluation code. Authored by Alexander Gavrilov (angavrilov) on Jan 7 2021, 7:10 PM.
Details Using malloc to allocate a temporary array for each vertex, Finally, a one line UI fix: the strength option is not bind specific.
Diff Detail
Event TimelineComment Actions 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? |