One of the most important challenges in sculpt mode optimization in Blender has been improving system resource management. Previously, locks in the execution of simultaneous processes caused a considerable loss of performance. With the new optimizations, these problems have been eliminated, offering a much smoother and more responsive sculpting experience.
The Impact of Concurrency on Digital Sculpting
Modern systems feature multi-core processors capable of executing multiple tasks in parallel. However, in previous versions of Blender, brush evaluation processes were not well optimized for this simultaneous execution, which caused:
- Processing thread conflicts that reduced performance.
- Locks in shared memory management.
- Longer wait times for brush application.
"An efficient system is one that distributes tasks without generating conflicts, making the most of hardware resources."
Identification of Bottlenecks
Performance analyses revealed that up to 60% of brush calculation time was spent waiting for memory access, rather than performing the necessary calculations. This was due to locks in the undo system, which drastically slowed down the software's response.
Improvements in Data Structures
To solve this problem, the linear search system in undo memory has been replaced with a data structure based on hash tables. This change has allowed:
- Instant access to information, without traversing large volumes of data.
- Reduction in processing thread wait times.
- Significant improvement in brush response speed.
Reduction of Memory Conflicts
Another detected problem was related to the simultaneous update of memory counters. Previously, every time a brush generated undo data, a global counter was updated, causing thread conflicts. Now, memory accounting is executed once all threads have completed their calculations, eliminating these conflicts and optimizing execution.
Optimization in Shared Variable Management
Even updating a boolean variable could represent a concurrency issue. It was detected that multiple threads were attempting to simultaneously modify a boolean value during the calculation of the average normal under the cursor. Eliminating this unnecessary variable has resulted in:
- A 200% improvement in performance in brush evaluation.
- Reduction in brush application latency.
- Greater stability in parallel task execution.
Smoother and Uninterrupted Sculpting
Thanks to these optimizations, brush evaluation in Blender is now faster and more efficient, allowing artists to work without interruptions. These improvements not only optimize current performance but also establish a solid foundation for future advanced sculpting tools.