Nheko-Reborn / nheko

Desktop client for Matrix using Qt and C++20.
https://nheko-reborn.github.io/
GNU General Public License v3.0
1.93k stars 201 forks source link

Noticeable lag when switching rooms #1654

Open vaxerski opened 9 months ago

vaxerski commented 9 months ago

Describe the bug

Whenever you switch a room, there is a good 1s lag before the room switches. Nheko freezes.

It's worth noting that there is less lag if there is less messages on screen - in a chat with only messages, the lag is about 1.5s. In a chat with a couple tall images sent - it's only like 0.3s.

To Reproduce

  1. Open a room
  2. Click on another room
  3. 1s lag during which nheko is frozen and shows the old room
  4. room switches

What happened?

Lag when switching, during the lag nheko shows the old room and freezes.

Expected behavior

Instant switching - even if there is some loading required, I'd prefer instant feedback. Give it a spinner, give it anything, but not stay on the old room. Preferably no lag.

Even the button click animation (the expanding ripple thing) is frozen. Maybe it's due to QML loading the messages and effectively halting the main thread until that's done?

Screenshots

No response

Version

0.11.3

Operating system

Linux

Installation method

Some repository (AUR, homebrew, distribution repository, PPA, etc)

Qt version

No response

C++ compiler

No response

Desktop Environment

Hyprland (Wayland)

Did you use profiles?

Relevant log output

Nheko does not log anything when the lag happens.

Backtrace

No response

deepbluev7 commented 9 months ago

Can you try the latest master to see, if the lag is still that bad?

vaxerski commented 9 months ago

still there, but less severe. With images, it's pretty much instant. With text, it can still be like 0.5s

Edit: with a lot of "system messages" (xyz joined / left etc) it's still like 1.5s

deepbluev7 commented 9 months ago

member events need additional database lookups, so that might explain it. Are you using some weird font maybe?

deepbluev7 commented 9 months ago

https://codereview.qt-project.org/c/qt/qtdeclarative/+/528884 might also help

vaxerski commented 9 months ago

member events need additional database lookups, so that might explain it. Are you using some weird font maybe?

Nheko database? Why are those things not async? "loading event", as a placeholder?

https://codereview.qt-project.org/c/qt/qtdeclarative/+/528884 might also help

Wish I knew how the hell to even test that

deepbluev7 commented 9 months ago

Nheko database? Why are those things not async? "loading event", as a placeholder?

Because that might improve interactivity, but increases latency and on my devices, even the old ones, the lag is usually below 200ms, which I find acceptable compared to having to wait 500ms and having to look at a placeholder in the meantime. I prefer to just make things faster instead.

vaxerski commented 9 months ago

fair enough, tho this is an NVMe laptop, on AC power, from like 2 years ago, and it's definitely not below 200ms. Happy to provide benchmarks / logs once pointed to what would be useful.