LCD performance

LCD performance

Quick introduction: A while ago we noticed our server sim going low very quickly, now after deleting a bunch of monospace lcds (like 10) and profiling again we noticed we agained back about a full millisecond of performance. So i decided to look into this issue a bit more.

When looking through code i noticed that UpdateAfterSimulation10 in MyTextpanel always does a .ToString() on the PublicDescription (All the text in the pb) so when people use monospace lcds with 30000+ characters it does this operation *every 10 ticks*. As you can imagine this is quite slow but i wanted to be sure so i profiled it first to confirm my suspicion.

Now how do we fix this; after discussing this with a couple of other community members, namely Malware and Digi we came to the conclusion that the current .Net implementation of StringBuilder no longer suits this task and that the best way to fix this massive performance issue would be to create a custom class that works like stringbuilder worked in earlier .Net versions.

The fact that StringBuilder isn’t suited for how they’re using it anymore. It probably was when the engine was started, but it was changed in one of the .NET versions, I forget which – and is no longer suitable.

They should replace it with a custom class that works the way StringBuilder worked before. Like List.

– Malware 3/5/2019

I hope this issue will get adressed pretty soon as its honestly quite a big performance drain on any server. All of this applies to both MyTextPanel and MyTextSurface ofcourse.