Jiggmin's Village

Full Version: race chat killing performance
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
everyboidy was complaiongin to me about pr2 lag so i ran adobe scout with pr2 open and played some traps with the boyz and i found the source of the lag. it's the race chat.

to any players who want to know how to avoid this lag for the time being: do not type at all in the chat, or at least minimize the chatting and message length


[Image: ogwZdhO.png]

i confirmed this by going alone into a campaign map and u can see the performance hit if u spam some ish in chat (max message text) and the lag is exaggerated if u move ur character around. see 52% of the frame time is spend updating text layout! it's being updated every frame--even if the chat doesn't change.

i located the exact line that causes this issue: the line in RaceChat.ensureBottom(), this callback is called twice per frame, and the line can safely be removed for a 50% performance boost (in my case, although it managed to get up to 70% when standfing still) during a maxed out chat.

to be specific it's the setting of the .htmlText that triggers the recalculation of the text layout. i see what you meant to do here, you wanted to set text scroll to bottom and just reused the showMessages() function. i'd put scroll to bottom code directly inline in the ensureBottom handler, or you can listen for the CHANGE event on the textboxes and set scroll to bottom there (cleaner imo).


on a related note text is kinda expensive to draw so there is more performance to be gained by having the ability to hide the race chat completely, or making messages expire after some time
Wow, nice sleuthing! This was one of the first fixes I made. I recall I had quite a hard time figuring out the problem because when set to execute on Event.CHANGE, it didn't work on some platforms.

At any rate, I'll fix this ASAP. Thanks!
(19th February 2021, 3:05 PM)oxy Wrote: [ -> ]-boop-

(19th February 2021, 8:37 PM)bls1999 Wrote: [ -> ]-boop2-

Does the tournament chat announcement cause any similar lag as well ?
Just curious
(19th February 2021, 11:47 PM)TRUC Wrote: [ -> ]Does the tournament chat announcement cause any similar lag as well ?
Just curious

Since it's sent in the race chat, yeah.
I just pushed a fix for this. I encountered the same problem I got a few years ago where I couldn't cancel the scroll event altogether for all platforms, so I:
- Made the trigger event MouseEvent.MOUSE_WHEEL
- Added that one line that scrolls to the bottom in showMessages() to ensureBottom()

Hopefully, this should fix the bug once and for all. Thanks again for poking around and finding the source of the lag!