I’ve come to realize that when my plugin needs to generate a lot of surfaces (using methods like NetworkSurface or CreateThroughPoints), it starts to slow down after a couple iterations.
This lag is more visible when a more complicated surface is being created - sometimes if I wanted to generate about 30 highly complex surfaces, the plugin would create the first two within a minute but then it would gradually take longer to do the rest (I waited a whole day for this to finish).
After generation, each surface is added to a List, and the process repeats.
What is causing this increasing lag? How can I fix this?