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.

Jason Wilkins (jwilkins) set Type to Patch.Via Old WorldMay 12 2012, 6:17 AM
Jason Wilkins (jwilkins) added a comment.Via Old WorldMay 12 2012, 7:12 AM

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

Applied in r47783.

Nicholas Bishop (nicholasbishop) closed this task as "Resolved".Via Old WorldJun 12 2012, 7:35 PM

Add Comment