In an effort to optimize my threejs scene, I noticed that the CPU usage was high even when the scene was not in use. After exploring various solutions, I tried removing the memory of mesh using the dispose()
method to prevent memory leaks.
labelMesh[i].geometry.dispose();
labelMesh[i].material.dispose();
However, upon inspecting the Javascript Profiler, I found that the dispose()
method actually increased the CPU usage of the garbage collector by 2 times.
Comparison without using dispose(): https://i.sstatic.net/k7VkI.png
Comparison with dispose(): https://i.sstatic.net/uSQcp.png
Should I continue using this solution or explore other alternatives for optimization?