I am not sure but that may be text best fit (line 24 in your code). Quick search gave me this forum thread: [NEW GUI]Text "bestfit" Performance Hit
Try to comment this line and see if that fixes the freeze
By the way, are you using the old UI text or TextMeshPro?
UpdateStringText uses StringBuilder unnecessarily and makes performance worse.
You (a) instantiate a new StringBuilder, (b) append only message, (c) instantiate a new string: ToString(), (d) assign to the text. The steps (a), (b), (c) are unnecessary and result in additional garbage generation.
You could simply assign the string to the text: text.text = message;
StringBuilders are useful when you want to concatenate several strings together. They may save performance in that situation.
That inefficiency, however, cannot account for 0.8 sec. There’s something else going on which we’d need to see pics from the Profiler to understand.