PointCloudsSystem stutter on <select> dropdown change

I’ve been porting a threeJS project to babylonJS (having a great time :slight_smile:), and came across some very strange behavior when trying to render my pointclouds.

In my project, I’ve got a static pointcloud placed in the scene, and I used the PointsCloudSystem to set this up. In my HTML (in electron), I have several drop-down menus for changing stuff.
I found that when rendering a large pointcloud, there would be major stutters whenever any of the drop-down menus changed state. This would happen even when the drop-down does nothing (zero event-listeners), which was quite strange and hard to debug.

I found that after simply switching from using the PointCloudsSystem to using a standard mesh with the pointcloud tag set to true, this stuttering behavior completely disappeared.

Edit: oops, typing <select> in here actually does something :stuck_out_tongue:

I suppose the drop-down change causes a lot of repaint events.

Just wondering whether this is the case: If you map your drop-down data to a reactive array be sure you are modifying the data in one batch and not one by one. This could cause a repaint every time you modify the array.

Should this affect meshes and PointsCloudSystems differently though?

It might if your page is close to max out the gpu ? would you happen to have repro ?

1 Like

I did some more testing and wasn’t able to reproduce the behaviour in a minimal environment. I had another look at the original case, and it would only happen when i loaded large pointcloud data (8.1*10^6 points). I did some profiling, and here you can clearly see when the stuttering occurs (keep in mind, the drop-down being clicked is a placeholder that does nothing)

I realize I’m probably the one doing something wrong here, and maybe this is unrelated to babylon. The cloud is also quite large. Still, maybe someone has an idea of what could be going on (why would it suddenly garbage-collect on clicking a placeholder dropdown?!)

looks like there is a huge Garbage Collection event (or 2) happening when it stutters.

You might be creating garbage collected part of memory.

1 Like

Can you share it?

I wasn’t able to repro :confused: . I would share the whole project but its closed source.
Anyway, the bug seems to not happen for reasonably sized point clouds (<5M), so I won’t bother looking further into it. It’s probably just a mistake on my part, creating too much garbage perhaps (though its puzzling the the drop-down event could trigger garbage collection on demand, that seriously makes no sense to me).
Thanks y’all.