Scene.remove issue


I just upgraded my three.js version for a pet project (I was using revision 70, and now the latest version), (and removed all the subsequent warnings I got.)

When trying to remove an object (with scene.remove), or to hide it (with obj.visible=false), my app freezes for a few seconds. No error message in the console, only "‘requestAnimationFrame’ handler took " ~3000ms. My browser is consumming 100% cpu meanwhile.
Reproduced on different browsers and OS.

(The scenes also seem generally longer to load.)

My scene is not very demanding : a hundred objects more or less.

Is there a recent change in the renderer that could explain this ? And a way to get rid of this problem ?

Thanks in advance,


You probably should use the devtools of your browsers first (chrome?). Record it and you’ll see what’s going on, since you said your CPU goes 100% you’ll see what’s the issue.


Thanks, I was unaware of the “Performance” tab in chrome devtools.

getShaderParameter is responsible for the 2/3 of the CPU load during the
freeze. So I tried to disable all shadows and lights one by one, and
located the issue : it’s when either a PointLight or a SpotLight is removed
from the scene that the freeze occurs.

Any idea why this occurs in the newest three.js version ?