The GetTextSize behaviour in the default chat causes multiple “UI_Layouts” (one for every message in the chat, I’m guessing). The resulting hang can potentially be very large. This is applicable to almost every roblox game (minus those with custom chats).
I know there has been a “whitelist” for some places with some ui flag disabled, but have not been keeping track of that. Similar behaviour can be seen in robeats (RoBeats! 🎧 Music + Rhythm + RPG - Roblox)
Sorry for the ping, but hoping to get your attention since we’re all likely off tomorrow for thanksgiving. This flag should be turned off globally if possible. @Tiffblocks@zeuxcg
do you need to type anything into chat? or is it when the message is sent that I should see this? Does it potentially require a larger backlog of messages?
I looked into this and it turned out to be the same bug I already fixed, except that a bug caused it being enabled to be ignored. The issue has been present for about a month, there is no need to do emergency flag flips the day before Thanksgiving.
I had to disable the fix a few days ago because it caused system messages to appear at the top of the log instead of inline with other messages. I’m working on a fix now, but it won’t ship until January.
This bug is detrimental to gameplay, I would much rather take out of place system messages than jarring FPS drops every two seconds. Is there any way this can be fixed sooner, or is there a way we can fork the chat scripts to fix it ourselves? This bug is atrocious and I am not willing to let it screw players over through the Christmas season.
If you’ve got the time (and the willingness to modify chat code) you can work around this issue in lua.
General gist of what you need to do (I’ve done this in robeats):
Cache the values of TextService:GetTextSize. It is extremely slow atm.
Modify MessageLogDisplay:PositionMessageLabelInWindow(messageObject) to not repeatedly call TextFits. This method is extremely slow atm as well.
There are also lots of micro-optimizations that can be done for chat code in general (that are unrelated to anything in this regression) involving reducing the amount of C/lua interop calls if you’re up for the task.
You should create a test setup that repeatedly spams system + user messages in the chat to simulate the environment of the performance issue.
You can force the previous fix to be enabled by changing this code in MessageLogDisplay:
local FlagFixChatMessageLogPerformance = false do
local ok, value = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserFixChatMessageLogPerformance")
end)
if ok then
FlagFixChatMessageLogPerformance = value
end
end
If anyone uses @Tiffblocks lag fix above but wants system messages to still be in order, I made some edits to the script myself for the meantime.
Insert the following code into the MessageLogDisplay module after line 168 which reads baseFrame.LayoutOrder = messageObject.ID
if baseFrame.LayoutOrder == -1 then
local Children = self.Scroller:GetChildren()
local MaxLayout = 0
for i = 1, #Children do
if Children[i]:IsA("Frame") then
MaxLayout = math.max(MaxLayout, Children[i].LayoutOrder)
end
end
baseFrame.LayoutOrder = MaxLayout
end
It seems system messages get inserted into the list of messages with a LayoutOrder of -1, so this searches the display log and shoves it in at the end.