UProceduralMeshComponent many sections

I made a map for a rts game with UProceduralMeshComponent. If I make 1 section with 60000 tris this works fine, but if I make 10000 sections with 6 tris each to assign different materials later, it takes very long to create. The first sections are quick, for example the first 100 sections are <= 1ms per section, but the more sections I have, the longer it takes to create new sections, for example if I have 1500 sections it takes about 2000ms to create 100 new sections. Is there some trick to avoid this behaviour? I’m using CreateMeshSection to create the sections. Perhaps I need to reserve memory to avoid memory allocation and copying or so?

When using CreateMeshSection, are you setting the bCreateCollision boolean to true?

Creating meshes added significant performance cost to the game, and adding thousands and thousands of sections of data to the UProceduralMesh component takes a lot more time.

If this is true, I would create the meshes right away with the bCreateCollision set to false, and then turn it on and off as needed.

I changed the code to use just one section per material, works now. But your answer doesn’t explain why the first sections are quick and then it takes longer and longer.