Sculpt Multi-Res Smooth Tool Memory Allocation Optimization
Closed, ResolvedPublic


This patch does two things to improve memory allocation for the multi-res branch of the smooth tool in sculpt.

1) Moves the allocation of the temporary memory buffer out of main stroke loop. No need to malloc and free the same sized buffer every dab.
2) Because the memory allocation is no longer contending from multiple threads there is no need to synchronize the use of malloc.

I have not tested to see if there is much of a performance improvement, but it cannot be a bad thing that malloc will be called once per stroke instead of potentially hundreds or thousands. The same goes for removing the potential performance costs of synchronizing threads on each of those mallocs.



Although I think it doe not make much difference, I uploaded a new patch that does not allocate the temporary buffer unless there is a multires modifier