Reduce Lag during Terrain Generation?

I am currently using Perlin Sound for terrain generation, and I can successfully generate terrains.
However, as I increase the map size, it’s becoming laggy, as more procedural actors are spawned in the map.

I’ve tried optimizing the procedural generation by using getRenderedActors and getNotRenderedActors from here (which helps to detect which object is in the viewport, and which object isn’t): How can I check if an object is visible by a camera? - Rendering - Epic Developer Community Forums, and setting actorHiddenInGame and actorCollisionEnabled for each procedural actor per tick. However, this doesn’t really work, as it’s still as laggy as usual.

I have been searching around for days with no luck. It would be great if I can get some recommendations on someone knows how runtime optimization for procedural generation works. I suspect it cannot be something that is done each tick for each procedural actor. Or else, am I doing the viewport object detection incorrectly?

Just a tip on huge amount of meshes - try hierarchical instanced static meshes. It’s great for static objects or foliage. You can easily add new instances. Uses a single draw call and is just a single actor. Though be vary that “remove” is actually “swap remove”. Cause of it you wont get lag on instance removal, but does not have a consistent ordering of the instances.

Thanks Felix, you are my savior! Adding collision to the terrain with hierarchical static meshes requires quite a fair amount of effort, but now, I am able to generate a terrain 20 times larger with the same fps performance as before. Just a fair tip btw: Unlike what a lot of people said, collision can be added to HISM, by modifying its collision settings in the code.

Just a heads up. After months of reserach, applying LoD drastically improved the runtime by at least 5 times as much, ironically, just by a few clicks of buttons (only if you are using static meshes in files to generate, does not apply to procedural meshes): Static Mesh Automatic LOD Generation in Unreal Engine | Unreal Engine 5.1 Documentation