[PR2 Bug] race chat killing performance
#1
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
The Following 7 Users Say Thank You to oxy For This Useful Post:
  • Atari4600, bi3liu, bls1999, ExplosionZ, JEEJAYEM, Magniloquent, Shocker14
#2
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!


I post about the latest site updates on the Dev Log. If you have suggestions, feel free to post them here.
@Eternal and I pay for this site out of our own savings. Please consider donating to help keep Jiggmin's Village running.
The Following 1 User Says Thank You to bls1999 For This Useful Post:
  • Shocker14
#3
(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
If you're reading this, it means I have not made a cool signature yet and you should be proud of yourself.
#4
(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 post about the latest site updates on the Dev Log. If you have suggestions, feel free to post them here.
@Eternal and I pay for this site out of our own savings. Please consider donating to help keep Jiggmin's Village running.
#5
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!


I post about the latest site updates on the Dev Log. If you have suggestions, feel free to post them here.
@Eternal and I pay for this site out of our own savings. Please consider donating to help keep Jiggmin's Village running.
The Following 5 Users Say Thank You to bls1999 For This Useful Post:
  • Ashley766, Battlealvin2009, JEEJAYEM, oxy, Shocker14


Forum Jump:


Users browsing this thread: 1 Guest(s)