Appreciate you taking time to improve the plugin, but keep in mind that the garbage collector in these older Unity versions was very crap to begin with:I dug a bit more into memory allocations and implemented reusable pools for all the lists and hashsets.
Even after that, there was still too much memory allocated on every frame.
A more performant incremental GC was introduced for 2022 versions and later as updates to older versions at a maximum of 2019.4:
''Unity’s garbage collector uses the Boehm–Demers–Weiser garbage collector. By default, Unity uses it in incremental mode, which means that the garbage collector splits up its workload over multiple frames, instead of stopping the main CPU thread (stop-the-world garbage collection) to process all objects on the managed heap. This means that Unity makes shorter interruptions to your application’s execution, instead of one long interruption to let the garbage collector process the objects on the managed heap.''
Incremental mode doesn’t make garbage collection faster overall, but because it distributes the workload over multiple frames, GC-related performance spikes are reduced. These interruptions are called GC spikes because they appear as large spikes in the Profiler window’s frame time graph.''
here's the source of the information:
Unity - Manual: Incremental garbage collection
And yes i always use AI to generate pretty much 70% to 80% of the code, then the rest is me manually reviewing the code to fix it & fine tune it. This is why i was able to make numerous plugins in a very short period of time.