JSON Utility Garbage Collection is HUGE

So I am using the JsonUtility to handle some data that I am getting from a server. It all works fine and dandy, but the garbage collection is pretty big, ABOUT 82 KB in total. About every second.

My CPU usage has a lot of jumps in the profile when the garbage collection happens, and I drop from about 300 FPS to 120 FPS. With VSYNC enabled it’s not that noticeable, but I still would like to have this running as efficiently as possible, obviously.

Does anyone know if there is a way to get the JSON utility running better?

Thanks

Haven’t worked with it alot so far, but you might wanna add some information about what you’re actually doing on a per-frame basis if it generates so much garbage every single frame?

JSONUtility is string manipulation. It probably could be done with less garbage if you wrote it from scratch. You would likely loose much of the advantages of ring into Unity’s serialisation system.

But ultimately you can’t manipulate strings without some garbage.

If you want better garbage performance, consider using a straight binary formatted. I don’t really see what advantage using a human readable format over a network gives you.