Major performance regressions for default ingame chat in any game

Repro steps:

  1. Join any full-ish server in jailbreak: Jailbreak - Roblox
  2. Open the microprofiler
  3. Type anything into the chat
  4. Observe the visible “spike” that is created.

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)

7 Likes

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?

It’s likely a UI_Layout (have not dug into the code) for every textlabel in the chat, so the server you need to join should be near full.

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’ll get the fix out soon for this.

7 Likes

When is this going to be fixed? This issue has been plaguing Ultimate Driving for what seems like months.

Same im having the issue rn

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.

Best of luck.

2 Likes

Noted, if we don’t get a fork from anyone official soon I’ll try this out.

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

to this:

local FlagFixChatMessageLogPerformance = true
3 Likes

Awesome, thanks!

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.

1 Like

@Tiffblocks any updates on this? This is a pretty serious performance issue for mobile devices.

4 Likes

Sorry for the late response, but the good news is we have a fix that is going thru the pipeline right now. Fix should be live in next week and a half.

3 Likes