space-wizards / RobustToolbox

Robust multiplayer game engine, used by Space Station 14
https://spacestation14.io
Other
532 stars 393 forks source link

Interning serv4 strings #4998

Open metalgearsloth opened 5 months ago

metalgearsloth commented 5 months ago

So at one point I checked and there was a lot of memory allocated for stuff like ambientsound strings. Might be better to either just globally use string interning for the datafields or alternatively make a separate serializer for it.

moonheart08 commented 5 months ago

As this is sourcegenned now we could likely just add a new datafield attribute or property that tells the serializer to call string.Intern() on the string.

metalgearsloth commented 1 month ago

Apparently string.Intern is omega-slow and FrozenDictionary might end up better so would just need to make a new manager for it and then lock it at some point.