How to animate thousands of spheres with the best performance?

It’s not that hard. You will want to use InstancedBufferGeometry.

Here’s an example with boxes. Nothing is moving in the example, but boxes are being added dynamically.

The example uses a somewhat advanced management system to keep track of the boxes, but you should be able to write a basic version of that to suit your needs.

The key is to adjust drawRange based on how many objects are added or removed fro mthe scene.