Insanely long GC jobs on mobile

Hello, I’ve been profiling mobile performance for my game.
For starters, the map is enormous, and detailed. And requires StreamingEnabled in order to work properly on mobile devices (otherwise it will simply crash).

However, as parts stream in and out, it is causing a massive strain on the garbage collector, which chains and lasts for several frames. As as result players can be dropped to 5-10fps for several seconds at a time.

Looking closer, I’ve annotated each section of the profiler and it does not look like code performance is causing the issue. Perhaps Roblox is not catching every debug message.


I’m wondering if anyone experiences similar, or was able to drastically reduce this value. At the moment my optimization plan is to convert all CollectionService remove methods I’ve added to first batch the elements, and then have a batch handler remove elements all at once to reduce table passthrough.

This issue also seems to only occur entirely on mobile, as PCs seemingly can handle this process effortlessly. Also, the phone I am testing this on is very low-end but it can handle everything else so this kind of hurdle is frustrating.

I had a game with a map a little bit smaller than this but with similar levels of detail.

The best way I found to do it was to make a sort of StreamingEnabledV2, where you first replicate the blank, empty map to the client then load the texturing and decoration after. This didn’t exactly fix the issue, but definitely boosted performance to a reasonable amount.

Have you tried ContextActionSevice?

Terrain is like 80k parts. I like the idea, sounds doable, but we already have a tag based level of detail system that streams out map locations and small models based on distance. So I don’t really gain further by doing that.

For us the issue is not that our drawcalls are high, we get good draw counts in most scenes on mobile. The problem is just computational issues, like handling the garbage collection of StreamingEnabled and throttling animations loaded.

For what context? We only use it for console controls and things that overwrite base movement.