Adding a mesh with a complicated geometry to the scene causes lag

Whenever I add this mesh to the scene that has 1280 vertices it makes a ton of lag until it is done loading. How do I fix this?

Just the amount of vertices does not describe a geometry’s complexity. At least the amount of faces is another important influence factor.

In any event, 1280 vertices represent not much data. The following live demo shows a cube with 2646 vertices. I don’t see any kind of lag on my iMac.

Just a follow up, as discussed on discord, the problem with lag wasn’t being caused by the geometry creation.

Alongside with the mesh, the code was adding new lights, therefore triggering a bunch of material recompiles.