After a period of time, the load is severely jammed

My scenes are all composed of boxes. The data is updated frame by frame and once every 50ms. Each frame has almost more than 200 boxes and a fixed grid coordinate system. The switching between frames is to perform dispose () on all the meshes of the previous frame through a traversal, and then draw the data of the new frame.
At the beginning, there was no jamming problem, but it soon became obvious that the camera could not be dragged.
How can I solve this problem?
Thx a lot.

1 Like

Welcome aboard!

It’s difficult to say without code. Are you able to reproduce the problem in the Playground?

3 Likes

Hello and welcome!

What would be the use case of calling dispose on each frame? Disposing of and creating objects is an expensive operation, so it’s usually better to reuse things when you can. Of course, it’s necessary sometimes, but for things like changing position, colors, etc… reusing the previous meshes boosts performance.

4 Likes

Hello,

Thanks for response, i found helpful things here, really appreciate for help myloweslife.

1 Like

Thank you for your enthusiasm. I have found the problem. Every time I create a mesh, I will assign it a material, and then I need to dispose all the meshes before the next frame, and then repeat the process for about 1000 times, because the materials used are the same. I use mesh. Clone () instead, which greatly improves my situation, The basic effect can be achieved

Thank you for your enthusiastic answer. I also want to reuse these meshes, but I need to realize it. Click mesh to display its corresponding specific information. I don’t know what the rendering order of mesh in babaylon is. If I don’t dispose all these meshes, I don’t know how to accurately bind the data to mesh, but I use mesh. Clone () for the problem of rendering speed The alternative results are acceptable