As we can see in this graph of the timeline of the threads inside the function
mesh_buffer_cache_create_requested, BKE_mesh_recalc_looptri has a
considerable effect on the total time spent:
(red indicates threads waiting for synchronization).
Inspired by the BKE_mesh_calc_normals_poly solution, this patch proposes to
calculate the meshes tessellation in multithreaded.
So the graph looks like this:
Profiling:
To compare performance, two files were used.
- subdiv_mesh_final_only.blend and
- looptri_test.blend.
The most important value to analyze is the time of iter, as the time of
BKE_mesh_calc_normals_poly is computed within this value.
These are the results:
MASTER: subdiv_mesh_final_only: - rdata 3ms iter 24ms (frame 154ms) - Average: 6.182961 FPS looptri_test: - rdata 11ms iter 97ms (frame 270ms) - Average: 3.472556 FPS PATCH: subdiv_mesh_final_only: - rdata 3ms iter 21ms (frame 156ms) - Average: 6.253956 FPS looptri_test: - rdata 11ms iter 38ms (frame 214ms) - Average: 4.367576 FPS
Fac iter path/master: subdiv_mesh_final_only: 0.87 looptri_test: 0.39
Operating system: Windows-10-10.0.18941 64 Bits
CPU: AMD Ryzen 7 1800x
Graphics card: Radeon (TM) RX 480 Graphics ATI Technologies Inc. 4.5.14760 Core Profile Context 20.45.37.01 27.20.14537.1001

