Procedual generation graph is extremely slow, only with specific section

Hi, I was using unreal 5.8 to make a procedural road. Basically I have a spline that always varies with distance at the start of the game, and a PCG graph spawns the road mesh, trees, even buildings that spawn depending on the district it’s in (the collision boxes that spawn in the world).

I followed one of ProceduralMinds city gen tutorials then extensively modified it to get to where I am at the moment. However, recently I’ve ran into a huge issue. Everything spawns well, but the performance gets gradually worse the longer the spline is. If it’s 5km, everything loads almost instantly, but if its 80km, everything loads extremely slowly and it can’t keep up with the car the player controls. Sometimes it entirely refuses to load. I’m pretty sure the issue lies within the trees and buildings, as when I remove that part of the graph everything loads quickly.

Im still fairly new to Procedural Generation, and I would really appreciate some help with ways to fix the performance with long distance roads. Please keep in mind the roads used to have intersections, so the spline mesh prep may also be too complex for it’s use because I might’ve incorrectly removed the intersection logic.

I attached a screenshot of the main PCG graph, and 2 subgraphs that are used, along with blueprint code showing how I generate the “district” zones that buildings fall in, which runs once at the start of the game, then the PCG graph runs afterwards. I also attached some of the PCG actor settings which will hopefully clear some things up. Although I am using a while loop to spawn the zones, that isn’t the cause of the extremely poor loading speed in the PCG graph. Apologies if the nodes look weird, I used an external plugin to take a screenshot of the whole graph to not lose resolution quality.

I am partitioning the splines, and with the 80km road all the spline meshes load around the player in ~4 seconds. its just with the whole buildings, district and driveway part where the issue lies. Because without that everything loads well, but with it included it significantly slows down.

the specific-section slowness plus a spline that varies at runtime points at re-evaluation storms: pcg is deterministic per partition, and every time the spline moves the affected partitions regenerate from scratch. if the spline updates every frame at the start of the game, the whole downstream graph re-executes constantly.

things to check in order:

is the spline actually changing every frame, or once at begin play? if anything drives it on tick, generate once and stop. a static spline makes the graph evaluate once and cache.

district lookup: if the district selection queries collision boxes per spawned point, that is a physics query per point per regeneration. cache the district volumes into a data structure once (tags or a data table of boxes) and do the point in box test with plain math in the graph instead of scene queries.

actor spawning vs static mesh spawner: if the buildings come out of a spawn actor node, that is enormously slower than instanced static meshes. reserve spawn actor for the few real actors, everything else through static mesh spawner.

partition bounds: limit the generation grid size and enable partitioning so regeneration touches only what changed. a giant single partition regenerates entirely on any change.

profile it: the pcg graph has debug and profiling options (draw debug pcg, and the pcg stats), run with them on for a few seconds and the hot node will name itself. usually it is one dense sampler or one scene query, not the graph as a whole.